001 /** 002 * planningtool - A Planning Tool with Critiquing Support. 003 * 004 * Copyright (C) 2006 olale 005 006 * This program is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU General Public License 008 * as published by the Free Software Foundation; either version 2 009 * of the License, or (at your option) any later version. 010 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 016 * You should have received a copy of the GNU General Public License 017 * along with this program; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 020 * Contact information: 021 * E-mail: olale@ida.liu.se 022 * olale@lysator.liu.se 023 */ 024 package se.liu.ida.critiquer.scenarios.standard; 025 026 import java.awt.Color; 027 028 import se.liu.ida.critiquer.resources.Agent; 029 import se.liu.ida.critiquer.resources.AgentFactory; 030 import se.liu.ida.critiquer.resources.DefaultAgent; 031 032 public class StandardAgentFactory implements AgentFactory { 033 034 private Agent topLevelAgent; 035 036 /* (non-Javadoc) 037 * @see se.liu.ida.critiquer.scenarios.standard.AgentFactory#getAgentStructure() 038 */ 039 public Agent getAgentStructure() { 040 if (topLevelAgent==null) { 041 topLevelAgent = new DefaultAgent("Top-level unit"); 042 043 Agent helicopterGroup = new DefaultAgent(topLevelAgent, "Helicopter Group"); 044 045 Helicopter heli1 = new Helicopter(helicopterGroup, "Helikopter 1"); 046 heli1.setTimeLineColor(Color.BLUE); 047 048 Helicopter heli2 = new Helicopter(helicopterGroup, "Helikopter 2"); 049 heli2.setTimeLineColor(Color.CYAN); 050 051 Agent ambulanceGroup = new DefaultAgent(topLevelAgent, "Ambulance Group"); 052 053 Ambulance ambulance1 = new Ambulance(ambulanceGroup, "Ambulans 1"); 054 ambulance1.setTimeLineColor(Color.RED); 055 056 Ambulance ambulance2 = new Ambulance(ambulanceGroup, "Ambulans 2"); 057 ambulance2.setTimeLineColor(Color.ORANGE); 058 059 Agent policeGroup = new DefaultAgent(topLevelAgent, "Police Group"); 060 061 PoliceUnit police1 = new PoliceUnit(policeGroup, "Polisbil 1"); 062 police1.setTimeLineColor(Color.BLACK); 063 064 PoliceUnit police2 = new PoliceUnit(policeGroup, "Polisbil 2"); 065 police2.setTimeLineColor(Color.LIGHT_GRAY); 066 067 } 068 return topLevelAgent; 069 070 } 071 072 }