<?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="date"> 
   <object class="java.util.Date"> 
    <long>1027310400000</long> 
   </object> 
  </void> 
  <void property="documentation"> 
   <array class="java.lang.String" length="9"> 
    <void index="0"> 
     <string>ew</string> 
    </void> 
    <void index="1"> 
     <string>7/22/02</string> 
    </void> 
    <void index="2"> 
     <string>8/14/02</string> 
    </void> 
    <void index="3"> 
     <string></string> 
    </void> 
    <void index="4"> 
     <string></string> 
    </void> 
    <void index="5"> 
     <string></string> 
    </void> 
    <void index="6"> 
     <string></string> 
    </void> 
    <void index="7"> 
     <string></string> 
    </void> 
    <void index="8"> 
     <string></string> 
    </void> 
   </array> 
  </void> 
  <void property="endTime"> 
   <int>10000</int> 
  </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>Value_MIN</string> 
         </void> 
         <void property="type"> 
          <string>double</string> 
         </void> 
         <void property="unit"> 
          <int>-1135038327</int> 
         </void> 
         <void property="value"> 
          <string>0.0</string> 
         </void> 
        </object> 
       </void> 
       <void method="add"> 
        <object class="eclpss.esv.Constant"> 
         <void property="index"> 
          <int>0</int> 
         </void> 
         <void property="name"> 
          <string>Value_MAX</string> 
         </void> 
         <void property="type"> 
          <string>double</string> 
         </void> 
         <void property="unit"> 
          <int>-1135038327</int> 
         </void> 
         <void property="value"> 
          <string>102400.0</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>Value</string> 
         </void> 
         <void property="type"> 
          <string>double</string> 
         </void> 
         <void property="unit"> 
          <int>-1135038327</int> 
         </void> 
        </object> 
       </void> 
      </void> 
      <void property="author"> 
       <string>re</string> 
      </void> 
      <void property="comments"> 
       <string></string> 
      </void> 
      <void property="constants"> 
       <void method="add"> 
        <object class="eclpss.esv.Constant"> 
         <void property="index"> 
          <int>0</int> 
         </void> 
         <void property="name"> 
          <string>MULTIPLIER</string> 
         </void> 
         <void property="type"> 
          <string>double</string> 
         </void> 
         <void property="unit"> 
          <int>0</int> 
         </void> 
         <void property="value"> 
          <string>100.0</string> 
         </void> 
        </object> 
       </void> 
      </void> 
      <void property="date"> 
       <object class="java.util.Date"> 
        <long>1014872400000</long> 
       </object> 
      </void> 
      <void property="externalLocation"> 
       <string>/home/wender/eclpssmodels/laplace/sim2/Temp.esv</string> 
      </void> 
      <void property="name"> 
       <string>Temp</string> 
      </void> 
      <void property="staticDeclarations"> 
       <string></string> 
      </void> 
      <void property="timeStamp"> 
       <object class="java.util.Date"> 
        <long>1014923858148</long> 
       </object> 
      </void> 
     </object> 
    </void> 
   </array> 
  </void> 
  <void property="executionGroups"> 
   <void method="add"> 
    <object class="eclpss.component.ExecutionGroup"> 
     <void property="memoryModel"> 
      <int>0</int> 
     </void> 
     <void property="name"> 
      <string>Execution Group 1</string> 
     </void> 
     <void property="specs"> 
      <object class="java.util.LinkedList"> 
       <void method="add"> 
        <object class="eclpss.component.ComponentSpecification"> 
         <void property="author"> 
          <string>ew</string> 
         </void> 
         <void property="date"> 
          <object class="java.util.Date"> 
           <long>1014872400000</long> 
          </object> 
         </void> 
         <void property="documentation"> 
          <array class="java.lang.String" length="18"> 
           <void index="0"> 
            <string>ew</string> 
           </void> 
           <void index="1"> 
            <string>2/28/02</string> 
           </void> 
           <void index="2"> 
            <string>7/22/02</string> 
           </void> 
           <void index="3"> 
            <string>7/22/02</string> 
           </void> 
           <void index="4"> 
            <string>7/22/02</string> 
           </void> 
           <void index="5"> 
            <string>7/22/02</string> 
           </void> 
           <void index="6"> 
            <string>7/22/02</string> 
           </void> 
           <void index="7"> 
            <string>7/22/02</string> 
           </void> 
           <void index="8"> 
            <string></string> 
           </void> 
           <void index="9"> 
            <string>&quot;silly&quot; simultation to show heat diffusion.</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="esvs"> 
          <array class="eclpss.esv.ESVSpecification" length="1"> 
           <void index="0"> 
            <object 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>Value_MIN</string> 
                </void> 
                <void property="type"> 
                 <string>double</string> 
                </void> 
                <void property="unit"> 
                 <int>-1135038327</int> 
                </void> 
                <void property="value"> 
                 <string>0.0</string> 
                </void> 
               </object> 
              </void> 
              <void method="add"> 
               <object class="eclpss.esv.Constant"> 
                <void property="index"> 
                 <int>0</int> 
                </void> 
                <void property="name"> 
                 <string>Value_MAX</string> 
                </void> 
                <void property="type"> 
                 <string>double</string> 
                </void> 
                <void property="unit"> 
                 <int>-1135038327</int> 
                </void> 
                <void property="value"> 
                 <string>102400.0</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>Value</string> 
                </void> 
                <void property="type"> 
                 <string>double</string> 
                </void> 
                <void property="unit"> 
                 <int>-1135038327</int> 
                </void> 
               </object> 
              </void> 
             </void> 
             <void property="author"> 
              <string>re</string> 
             </void> 
             <void property="comments"> 
              <string></string> 
             </void> 
             <void property="constants"> 
              <void method="add"> 
               <object class="eclpss.esv.Constant"> 
                <void property="index"> 
                 <int>0</int> 
                </void> 
                <void property="name"> 
                 <string>MULTIPLIER</string> 
                </void> 
                <void property="type"> 
                 <string>double</string> 
                </void> 
                <void property="unit"> 
                 <int>0</int> 
                </void> 
                <void property="value"> 
                 <string>100.0</string> 
                </void> 
               </object> 
              </void> 
             </void> 
             <void property="date"> 
              <object class="java.util.Date"> 
               <long>1014872400000</long> 
              </object> 
             </void> 
             <void property="externalLocation"> 
              <string>/home/wender/eclpssmodels/laplace/sim2/Temp.esv</string> 
             </void> 
             <void property="name"> 
              <string>Temp</string> 
             </void> 
             <void property="staticDeclarations"> 
              <string></string> 
             </void> 
             <void property="timeStamp"> 
              <object class="java.util.Date"> 
               <long>1014923858148</long> 
              </object> 
             </void> 
            </object> 
           </void> 
          </array> 
         </void> 
         <void property="externalLocation"> 
          <string>/home/tsmart/public_html/classes/eclpssSaves/HeatDiffusion/Components/CoolDown.cpt</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;2/28/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Date Saved: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Version: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;&lt;br&gt;
 *&lt;LI&gt;&lt;b&gt;Purpose: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Algorithm Citation: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Modification History: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Assumptions: &lt;/b&gt;7/22/02&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;&quot;silly&quot; simultation to show heat diffusion.&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;
*/
</string> 
         </void> 
         <void property="localMethodCode"> 
          <string>
// make an array of hot cell Points (for current and previous time
// frames.

Point [] hotCellsCurrent = new Point [2];
Point [] hotCellsPrevious = new Point [2];



static int xLeft, xRight, yLeft, yRight;

// ECLPSSgrid is a &quot;generic&quot; grid - the framework replaces
// it with the correct name at model run time.

void getBounds(ECLPSSGrid grid, Point current) {
   xLeft = grid.getAbsXLB()-1;
   xRight = grid.getAbsXUB()-1;
   yLeft = grid.getAbsYLB()-1;
   yRight = grid.getAbsYUB()-1;
}

// relative offsets from current
static final Point N = new Point( 0, -1, BACK1 );
static final Point S = new Point( 0, 1, BACK1 );
static final Point E = new Point( 1, 0, BACK1 );
static final Point W = new Point( -1, 0, BACK1 );



/** checks to see if the 2-D grid cell at absolute
    address (x,y) is a corner cell.
    @param x - absolute address of x
    @param y - absolute address of y
    @return true if a corner cell, false otherwise
*/

public boolean isCorner(int x, int y) {
return ( (x==xLeft &amp;&amp; y==yLeft) ||
         (x==xRight &amp;&amp; y==yLeft) ||
         (x==xLeft &amp;&amp; y==yRight) ||
         (x==xRight &amp;&amp; y==yRight) );
}

/** checks to see if the 2-D grid cell at absolute
    address (x,y) is  on a side of the grid.
    @param x - absolute address of x
    @param y - absolute address of y
    @return true if (x,y) the side of grid, false otherwise
*/

public boolean isSide(int x, int y) {
        return (!isCorner(x,y) &amp;&amp; 
                (x==xLeft || x==xRight || y==yLeft || y==yRight)
               );
}</string> 
         </void> 
         <void property="name"> 
          <string>CoolDown</string> 
         </void> 
         <void property="numTimeFrames"> 
          <int>2</int> 
         </void> 
         <void property="preSimCode"> 
          <string>
// initialize the hot cells to be in the upper left and lower right

int xlbindex = grid.getAbsXLB()-1;
int ylbindex = grid.getAbsYLB()-1; 
int yub= grid.getAbsYUB();
int xub= grid.getAbsXUB();



// iterate over the entire grid

for (int i=xlbindex; i&lt; xub; i++) {
   for (int j = ylbindex; j&lt;yub; j++) {
        
// the designated cells hot 
// and make the rest of the grid cold
            
      if (i == xlbindex &amp;&amp; j == ylbindex) {
         // initialize grid
              grid.writeAbsTemp(current,new Point(i,j,NOW)).add(new Temp(Temp.Value_MAX));

         // initialize arrays
         hotCellsCurrent[0] = new Point(i,j,NOW);
         hotCellsPrevious[0] = new Point(i,j,BACK1);
      }
      if (i == xub-1 &amp;&amp; j == yub-1 ) {
         // initialize grid
              grid.writeAbsTemp(current,new Point(i,j,0)).add(new Temp(Temp.Value_MAX));

         // initialize arrays
         hotCellsCurrent[1] = new Point(i,j,NOW);
         hotCellsPrevious[1] = new Point(i,j,BACK1);
      }
      else {
         // just a regular cell - initialize grid
         grid.writeAbsTemp(current,new Point(i,j,NOW)).add(new Temp(Temp.Value_MIN));
      }
   }
}
//write out the hot cell addresses

for (int i=0; i&lt; hotCellsCurrent.length; i++) {
   System.out.println(&quot;hotCellsCurrent[&quot;+i+&quot;] = &quot;+hotCellsCurrent[i]);
   System.out.println(&quot;hotCellsPrevious[&quot;+i+&quot;] = &quot;+hotCellsPrevious[i]);
}
</string> 
         </void> 
         <void property="simCode"> 
          <string>

int x = current.getX();
int y = current.getY();

int it = model.getTimeIteration();

// print the iteration number to the console modulo displayRate
//if (x==0 &amp;&amp; y==0 &amp;&amp; ((it-1) % model.displayRate == 0) )
   //System.out.println(&quot;Iteration &quot;+it);

double temp = 0.0;
double north = 0.0;
double south = 0.0;
double east = 0.0;
double west = 0.0;

try { south = grid.readTemp(current,S).getValue(); }
catch (Exception e) {}

try { north = grid.readTemp(current,N).getValue(); }
catch (Exception e) {}

try { east = grid.readTemp(current,E).getValue(); }
catch (Exception e) {}

try { west = grid.readTemp(current,W).getValue(); }
catch (Exception e) {}


getBounds(grid, current);




// since all points are either correct (within the grid boundaries)
// or 0.0 (all points are initialized to 0, and any out-of-bound gets 
// are caught)
//we can add them all up, and then just divide by the appropriate amount.
//I&apos;m multiplying (where there is no roundoff error) since it is faster than divide

   if (isCorner(x,y)) {
      grid.writeTemp(current,CURRENT).add(new Temp( (north+south+east+west)*0.5));
   }
   else if (isSide(x,y)) {
      grid.writeTemp(current,CURRENT).add(new Temp( (north+south+east+west)/3.0));
   }
   else {
      grid.writeTemp(current,CURRENT).add(new Temp( (north+south+east+west)*0.25));
   }



   for (int i=0; i&lt; hotCellsCurrent.length; i++) {
      if (x==hotCellsCurrent[i].getX() &amp;&amp; y == hotCellsCurrent[i].getY()) {

        // get previous temperature
        temp = grid.readAbsTemp(hotCellsPrevious[i]).getValue();
             //System.out.println(&quot;read temp &quot;+temp+&quot; from &quot;+hotCellsPrevious[i]);
        //System.out.println(model.getTimeIteration());

        // write it here and now
        grid.writeAbsTemp(hotCellsCurrent[i]).setValue(temp);
             //System.out.println(&quot;write temp to &quot;+hotCellsCurrent[i]);
      }
   }

</string> 
         </void> 
         <void property="staticDeclarations"> 
          <string></string> 
         </void> 
         <void property="timeStamp"> 
          <object class="java.util.Date"> 
           <long>1027349505733</long> 
          </object> 
         </void> 
        </object> 
       </void> 
       <void method="add"> 
        <object class="eclpss.component.ComponentSpecification"> 
         <void property="author"> 
          <string>ew</string> 
         </void> 
         <void property="date"> 
          <object class="java.util.Date"> 
           <long>1014872400000</long> 
          </object> 
         </void> 
         <void property="documentation"> 
          <array class="java.lang.String" length="18"> 
           <void index="0"> 
            <string>ew</string> 
           </void> 
           <void index="1"> 
            <string>2/28/02</string> 
           </void> 
           <void index="2"> 
            <string>7/23/02</string> 
           </void> 
           <void index="3"> 
            <string>7/22/02</string> 
           </void> 
           <void index="4"> 
            <string>2/28/02</string> 
           </void> 
           <void index="5"> 
            <string></string> 
           </void> 
           <void index="6"> 
            <string>Display the grid temperatures as ranging from &quot;red&quot; (hottest) to &quot;blue&quot; (coldest).</string> 
           </void> 
           <void index="7"> 
            <string></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="esvs"> 
          <array class="eclpss.esv.ESVSpecification" length="1"> 
           <void index="0"> 
            <object 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>Value_MIN</string> 
                </void> 
                <void property="type"> 
                 <string>double</string> 
                </void> 
                <void property="unit"> 
                 <int>-1135038327</int> 
                </void> 
                <void property="value"> 
                 <string>0.0</string> 
                </void> 
               </object> 
              </void> 
              <void method="add"> 
               <object class="eclpss.esv.Constant"> 
                <void property="index"> 
                 <int>0</int> 
                </void> 
                <void property="name"> 
                 <string>Value_MAX</string> 
                </void> 
                <void property="type"> 
                 <string>double</string> 
                </void> 
                <void property="unit"> 
                 <int>-1135038327</int> 
                </void> 
                <void property="value"> 
                 <string>102400.0</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>Value</string> 
                </void> 
                <void property="type"> 
                 <string>double</string> 
                </void> 
                <void property="unit"> 
                 <int>-1135038327</int> 
                </void> 
               </object> 
              </void> 
             </void> 
             <void property="author"> 
              <string>re</string> 
             </void> 
             <void property="comments"> 
              <string></string> 
             </void> 
             <void property="constants"> 
              <void method="add"> 
               <object class="eclpss.esv.Constant"> 
                <void property="index"> 
                 <int>0</int> 
                </void> 
                <void property="name"> 
                 <string>MULTIPLIER</string> 
                </void> 
                <void property="type"> 
                 <string>double</string> 
                </void> 
                <void property="unit"> 
                 <int>0</int> 
                </void> 
                <void property="value"> 
                 <string>100.0</string> 
                </void> 
               </object> 
              </void> 
             </void> 
             <void property="date"> 
              <object class="java.util.Date"> 
               <long>1014872400000</long> 
              </object> 
             </void> 
             <void property="externalLocation"> 
              <string>/home/wender/eclpssmodels/laplace/sim2/Temp.esv</string> 
             </void> 
             <void property="name"> 
              <string>Temp</string> 
             </void> 
             <void property="staticDeclarations"> 
              <string></string> 
             </void> 
             <void property="timeStamp"> 
              <object class="java.util.Date"> 
               <long>1014923858148</long> 
              </object> 
             </void> 
            </object> 
           </void> 
          </array> 
         </void> 
         <void property="externalLocation"> 
          <string>/home/tsmart/public_html/classes/eclpssSaves/HeatDiffusion/Components/Display.cpt</string> 
         </void> 
         <void property="graphical"> 
          <boolean>true</boolean> 
         </void> 
         <void property="height"> 
          <int>600</int> 
         </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;2/28/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Date Saved: &lt;/b&gt;7/23/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Version: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;&lt;br&gt;
 *&lt;LI&gt;&lt;b&gt;Purpose: &lt;/b&gt;2/28/02&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;Display the grid temperatures as ranging from &quot;red&quot; (hottest) to &quot;blue&quot; (coldest).&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Assumptions: &lt;/b&gt;&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;
*/
</string> 
         </void> 
         <void property="localMethodCode"> 
          <string>public void paint(Graphics g) {
 //java.awt.Container con = getContentPane();
 g.drawImage(image,15,30,Color.blue,this);
}



JPanel canvas = null;
Graphics2D offScreen = null;
int frameWidth = 500;
int frameHeight = 500;
java.awt.image.BufferedImage image = new java.awt.image.BufferedImage
  (frameWidth, frameHeight, java.awt.image.BufferedImage.TYPE_INT_RGB);
</string> 
         </void> 
         <void property="name"> 
          <string>Display</string> 
         </void> 
         <void property="numTimeFrames"> 
          <int>2</int> 
         </void> 
         <void property="simCode"> 
          <string>  int x = current.getX();
   int y = current.getY();
        if( ((model.getTimeIteration()-1) % model.displayRate) == 0 ) {
   if( x == grid.getXUB() - 1 &amp;&amp;
       y == grid.getYUB() - 1) {
      // at the end of the iteration
      if(offScreen == null) {
        offScreen = image.createGraphics();
        //canvas = new JPanel();
        //getContentPane().add(canvas);
        //validate();
      }
      int xUB = grid.getAbsXUB();
      int yUB = grid.getAbsYUB();
      int blockWidth = frameWidth / xUB;
      int blockHeight = frameHeight / yUB;
      int temp = 0;
      int rgb = 0;
      ChangeablePoint p = new ChangeablePoint(0,0,-1);
		boolean raised = true;
		//if(model.getTimeIteration() % 2 == 0){
			//raised = !raised;
			//offScreen.rotate(Math.PI/2,250,250);
		//}

//		if(model.getTimeIteration() % 2 == 0){
//		  	raised = !raised;
//			for(int xx=0; xx&lt;=xUB; xx++) {
//        		p.setX(xUB-xx);
//        		for(int yy=0; yy&lt;=yUB; yy++) {
//          		p.setY(yUB-yy-1);
//          		try{
//           		  temp = (int) grid.readAbsTemp(current,p).getValue();
//          		}
//          		catch(Exception e){}
//          		temp /= Temp.MULTIPLIER;
//          		// hold blue at 255, increase amount of green
//                    if(temp &lt; 255) {
//                       rgb = (temp &lt;&lt; 8) + 255;
//                    }
//         	 	// hold green at 255, decrease amount of blue
//                    else if(temp &lt; 511) {
//                       rgb = (255 &lt;&lt; 8) + (255 - (temp - 255));
//                    }
//          		// hold green at 255 increase amount of red
//                    else if(temp &lt; 767) {
//                       rgb = ((temp - 511)&lt;&lt;16) + (255 &lt;&lt; 8);
//                    }
//          		// hold red at 255 decrease amount of green
//                    else if(temp &lt; 1023) {
//                       rgb = (255 &lt;&lt; 16) + ((255 - (temp - 767)) &lt;&lt; 8);
//                    }
//                    else {
//                       rgb = 0xff0000;
//                    }
//                   offScreen.setColor(new java.awt.Color(rgb));
//    
//         //offScreen.fill3DRect(xx*blockWidth, yy*blockWidth,
//         //  blockWidth, blockHeight, true);
//			//boolean raised = (xx%2 == 0)&amp;&amp;(yy%2 == 0); //cool display
//			  raised = !raised;
//			  offScreen.fill3DRect((xUB-xx)*blockWidth,(yy)*blockWidth,
//				 blockWidth, blockHeight, raised);
//        }
//      }
//	}

//	else{

      for(int xx=0; xx&lt;xUB; xx++) {
        p.setX(xx);
//		  raised = !raised;
        for(int yy=0; yy&lt;yUB; yy++) {
          p.setY(yy);
          try{
             temp = (int) grid.readAbsTemp(current,p).getValue();
          }
          catch(Exception e){}
          temp /= Temp.MULTIPLIER;
          // hold blue at 255, increase amount of green
                    if(temp &lt; 255) {
                       rgb = (temp &lt;&lt; 8) + 255;
                    }
          // hold green at 255, decrease amount of blue
                    else if(temp &lt; 511) {
                       rgb = (255 &lt;&lt; 8) + (255 - (temp - 255));
                    }
          // hold green at 255 increase amount of red
                    else if(temp &lt; 767) {
                       rgb = ((temp - 511)&lt;&lt;16) + (255 &lt;&lt; 8);
                    }
          // hold red at 255 decrease amount of green
                    else if(temp &lt; 1023) {
                       rgb = (255 &lt;&lt; 16) + ((255 - (temp - 767)) &lt;&lt; 8);
                    }
                    else {
                       rgb = 0xff0000;
                    }
                   offScreen.setColor(new java.awt.Color(rgb));
    
         //offScreen.fill3DRect(xx*blockWidth, yy*blockWidth,
         //  blockWidth, blockHeight, true);
			//boolean raised = (xx%2 == 0)&amp;&amp;(yy%2 == 0); //cool display
//			  raised = !raised;
			  offScreen.fill3DRect(xx*blockWidth, yy*blockWidth,
				 blockWidth, blockHeight, true);
        }
      }

      repaint();
    }
    }</string> 
         </void> 
         <void property="staticDeclarations"> 
          <string></string> 
         </void> 
         <void property="timeStamp"> 
          <object class="java.util.Date"> 
           <long>1027444357647</long> 
          </object> 
         </void> 
         <void property="width"> 
          <int>600</int> 
         </void> 
        </object> 
       </void> 
      </object> 
     </void> 
    </object> 
   </void> 
  </void> 
  <void property="externalLocation"> 
   <string>/home/tsmart/public_html/classes/eclpssSaves/HeatDiffusion/HeatDiffusion.mdl</string> 
  </void> 
  <void property="grid"> 
   <object class="eclpss.grid.GridSpecification"> 
    <void property="author"> 
     <string>ew</string> 
    </void> 
    <void property="comments"> 
     <string>Grid units aren&apos;t necessary.</string> 
    </void> 
    <void property="date"> 
     <object class="java.util.Date"> 
      <long>1002427200000</long> 
     </object> 
    </void> 
    <void property="externalLocation"> 
     <string>/home/tsmart/public_html/classes/eclpssSaves/HeatDiffusion/Grid/SimGrid.grd</string> 
    </void> 
    <void property="name"> 
     <string>SimGrid</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>1029372789259</long> 
     </object> 
    </void> 
    <void property="x"> 
     <object class="eclpss.grid.GridDimension"> 
      <void property="boundryType"> 
       <int>4</int> 
      </void> 
      <void property="cellWidth"> 
       <double>1.0</double> 
      </void> 
      <void property="numberOfCells"> 
       <int>100</int> 
      </void> 
      <void property="unit"> 
       <int>-1</int> 
      </void> 
     </object> 
    </void> 
    <void property="y"> 
     <object class="eclpss.grid.GridDimension"> 
      <void property="boundryType"> 
       <int>4</int> 
      </void> 
      <void property="cellWidth"> 
       <double>1.0</double> 
      </void> 
      <void property="numberOfCells"> 
       <int>100</int> 
      </void> 
      <void property="unit"> 
       <int>-1</int> 
      </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;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Date Saved: &lt;/b&gt;8/14/02&lt;/LI&gt;&lt;BR&gt;&lt;br&gt;
 *&lt;LI&gt;&lt;b&gt;Version: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Purpose: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Type of Grid: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Time step, time scale: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Usage Notes: &lt;/b&gt;&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>HeatDiffusion</string> 
  </void> 
  <void property="numberOfExecutions"> 
   <int>9999</int> 
  </void> 
  <void property="preComponents"> 
   <void method="add"> 
    <object class="eclpss.component.ComponentSpecification"> 
     <void property="author"> 
      <string>ew</string> 
     </void> 
     <void property="date"> 
      <object class="java.util.Date"> 
       <long>1014872400000</long> 
      </object> 
     </void> 
     <void property="documentation"> 
      <array class="java.lang.String" length="18"> 
       <void index="0"> 
        <string>ew</string> 
       </void> 
       <void index="1"> 
        <string>2/28/02</string> 
       </void> 
       <void index="2"> 
        <string>7/22/02</string> 
       </void> 
       <void index="3"> 
        <string>7/22/02</string> 
       </void> 
       <void index="4"> 
        <string>7/22/02</string> 
       </void> 
       <void index="5"> 
        <string>7/22/02</string> 
       </void> 
       <void index="6"> 
        <string>7/22/02</string> 
       </void> 
       <void index="7"> 
        <string>7/22/02</string> 
       </void> 
       <void index="8"> 
        <string></string> 
       </void> 
       <void index="9"> 
        <string>&quot;silly&quot; simultation to show heat diffusion.</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="esvs"> 
      <array class="eclpss.esv.ESVSpecification" length="1"> 
       <void index="0"> 
        <object idref="ESVSpecification0"/> 
       </void> 
      </array> 
     </void> 
     <void property="externalLocation"> 
      <string>/home/tsmart/public_html/classes/eclpssSaves/HeatDiffusion/Components/CoolDown.cpt</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;2/28/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Date Saved: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Version: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;&lt;br&gt;
 *&lt;LI&gt;&lt;b&gt;Purpose: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Algorithm Citation: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Modification History: &lt;/b&gt;7/22/02&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Assumptions: &lt;/b&gt;7/22/02&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;&quot;silly&quot; simultation to show heat diffusion.&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;
*/
</string> 
     </void> 
     <void property="localMethodCode"> 
      <string>
// make an array of hot cell Points (for current and previous time
// frames.

Point [] hotCellsCurrent = new Point [2];
Point [] hotCellsPrevious = new Point [2];



static int xLeft, xRight, yLeft, yRight;

// ECLPSSgrid is a &quot;generic&quot; grid - the framework replaces
// it with the correct name at model run time.

void getBounds(ECLPSSGrid grid, Point current) {
   xLeft = grid.getAbsXLB()-1;
   xRight = grid.getAbsXUB()-1;
   yLeft = grid.getAbsYLB()-1;
   yRight = grid.getAbsYUB()-1;
}

// relative offsets from current
static final Point N = new Point( 0, -1, BACK1 );
static final Point S = new Point( 0, 1, BACK1 );
static final Point E = new Point( 1, 0, BACK1 );
static final Point W = new Point( -1, 0, BACK1 );



/** checks to see if the 2-D grid cell at absolute
    address (x,y) is a corner cell.
    @param x - absolute address of x
    @param y - absolute address of y
    @return true if a corner cell, false otherwise
*/

public boolean isCorner(int x, int y) {
return ( (x==xLeft &amp;&amp; y==yLeft) ||
         (x==xRight &amp;&amp; y==yLeft) ||
         (x==xLeft &amp;&amp; y==yRight) ||
         (x==xRight &amp;&amp; y==yRight) );
}

/** checks to see if the 2-D grid cell at absolute
    address (x,y) is  on a side of the grid.
    @param x - absolute address of x
    @param y - absolute address of y
    @return true if (x,y) the side of grid, false otherwise
*/

public boolean isSide(int x, int y) {
        return (!isCorner(x,y) &amp;&amp; 
                (x==xLeft || x==xRight || y==yLeft || y==yRight)
               );
}</string> 
     </void> 
     <void property="name"> 
      <string>CoolDown</string> 
     </void> 
     <void property="numTimeFrames"> 
      <int>2</int> 
     </void> 
     <void property="preSimCode"> 
      <string>
// initialize the hot cells to be in the upper left and lower right

int xlbindex = grid.getAbsXLB()-1;
int ylbindex = grid.getAbsYLB()-1; 
int yub= grid.getAbsYUB();
int xub= grid.getAbsXUB();



// iterate over the entire grid

for (int i=xlbindex; i&lt; xub; i++) {
   for (int j = ylbindex; j&lt;yub; j++) {
        
// the designated cells hot 
// and make the rest of the grid cold
            
      if (i == xlbindex &amp;&amp; j == ylbindex) {
         // initialize grid
              grid.writeAbsTemp(current,new Point(i,j,NOW)).add(new Temp(Temp.Value_MAX));

         // initialize arrays
         hotCellsCurrent[0] = new Point(i,j,NOW);
         hotCellsPrevious[0] = new Point(i,j,BACK1);
      }
      if (i == xub-1 &amp;&amp; j == yub-1 ) {
         // initialize grid
              grid.writeAbsTemp(current,new Point(i,j,0)).add(new Temp(Temp.Value_MAX));

         // initialize arrays
         hotCellsCurrent[1] = new Point(i,j,NOW);
         hotCellsPrevious[1] = new Point(i,j,BACK1);
      }
      else {
         // just a regular cell - initialize grid
         grid.writeAbsTemp(current,new Point(i,j,NOW)).add(new Temp(Temp.Value_MIN));
      }
   }
}
//write out the hot cell addresses

for (int i=0; i&lt; hotCellsCurrent.length; i++) {
   System.out.println(&quot;hotCellsCurrent[&quot;+i+&quot;] = &quot;+hotCellsCurrent[i]);
   System.out.println(&quot;hotCellsPrevious[&quot;+i+&quot;] = &quot;+hotCellsPrevious[i]);
}
</string> 
     </void> 
     <void property="simCode"> 
      <string>

int x = current.getX();
int y = current.getY();

int it = model.getTimeIteration();

// print the iteration number to the console modulo displayRate
//if (x==0 &amp;&amp; y==0 &amp;&amp; ((it-1) % model.displayRate == 0) )
   //System.out.println(&quot;Iteration &quot;+it);

double temp = 0.0;
double north = 0.0;
double south = 0.0;
double east = 0.0;
double west = 0.0;

try { south = grid.readTemp(current,S).getValue(); }
catch (Exception e) {}

try { north = grid.readTemp(current,N).getValue(); }
catch (Exception e) {}

try { east = grid.readTemp(current,E).getValue(); }
catch (Exception e) {}

try { west = grid.readTemp(current,W).getValue(); }
catch (Exception e) {}


getBounds(grid, current);




// since all points are either correct (within the grid boundaries)
// or 0.0 (all points are initialized to 0, and any out-of-bound gets 
// are caught)
//we can add them all up, and then just divide by the appropriate amount.
//I&apos;m multiplying (where there is no roundoff error) since it is faster than divide

   if (isCorner(x,y)) {
      grid.writeTemp(current,CURRENT).add(new Temp( (north+south+east+west)*0.5));
   }
   else if (isSide(x,y)) {
      grid.writeTemp(current,CURRENT).add(new Temp( (north+south+east+west)/3.0));
   }
   else {
      grid.writeTemp(current,CURRENT).add(new Temp( (north+south+east+west)*0.25));
   }



   for (int i=0; i&lt; hotCellsCurrent.length; i++) {
      if (x==hotCellsCurrent[i].getX() &amp;&amp; y == hotCellsCurrent[i].getY()) {

        // get previous temperature
        temp = grid.readAbsTemp(hotCellsPrevious[i]).getValue();
             //System.out.println(&quot;read temp &quot;+temp+&quot; from &quot;+hotCellsPrevious[i]);
        //System.out.println(model.getTimeIteration());

        // write it here and now
        grid.writeAbsTemp(hotCellsCurrent[i]).setValue(temp);
             //System.out.println(&quot;write temp to &quot;+hotCellsCurrent[i]);
      }
   }

</string> 
     </void> 
     <void property="staticDeclarations"> 
      <string></string> 
     </void> 
     <void property="timeStamp"> 
      <object class="java.util.Date"> 
       <long>1027349505733</long> 
      </object> 
     </void> 
    </object> 
   </void> 
  </void> 
  <void property="startTime"> 
   <int>1</int> 
  </void> 
  <void property="statics"> 
   <void method="add"> 
    <object class="eclpss.model.StaticVariable"> 
     <void property="final"> 
      <boolean>true</boolean> 
     </void> 
     <void property="name"> 
      <string>displayRate</string> 
     </void> 
     <void property="string"> 
      <string>public static final int displayRate = 1;</string> 
     </void> 
     <void property="type"> 
      <string>int</string> 
     </void> 
     <void property="value"> 
      <string>1</string> 
     </void> 
    </object> 
   </void> 
  </void> 
  <void property="timeStamp"> 
   <object class="java.util.Date"> 
    <long>1029372947592</long> 
   </object> 
  </void> 
 </object> 
</java> 
