To load this file without formatting, visit http://whoyouknow.co.uk/ants/AntGraph/java/4/src/antgraph/Nest.java. This is a spam-protection measure; sorry for the inconvenience.

· Nest.java ·

   1/*
   2 * Nets1.java
   3 *
   4 * Created on March 21, 2007, 10:24 PM
   5 *
   6 * To change this tfgemplate, choose Tools | Template Manager
   7 * and open the template in the editor.
   8 */
   9
  10package antgraph;
  11
  12import antgraph.gui.GraphJFrame;
  13
  14/**
  15 *
  16 * @author james
  17 */
  18public class Nest extends Node {
  19    
  20    /** Creates a new instance of Nets1 */
  21    public Nest(String name, int x, int y) {
  22        super(name, x, y);
  23    }
  24    
  25    public Nest(String name) {
  26        super(name);
  27    }
  28    
  29    public void addAnt() {
  30        Ant ant = new Ant(this);
  31        super.addAnt(ant);
  32        GraphJFrame.getGraph().addAnt(ant);        
  33    }
  34    
  35    public void addAnts(int n) {
  36        for(int i = 0; i < n; i++)
  37            addAnt();
  38    }
  39    
  40    public void addAnt(Ant ant) {
  41        System.out.println("Ant returned to nest");
  42        addFood(ant.getFood());
  43        ant.setFood(null);
  44        super.addAnt(ant);
  45    }
  46}
  47

· Nest.java ends ·

Generated by CHIP: Code Highlighting in PHP, version 2.7.0.