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.simulation; 025 026 import java.awt.Graphics2D; 027 028 import se.liu.ida.critiquer.gui.GeoView; 029 import se.liu.ida.critiquer.resources.Agent; 030 031 /** 032 * 033 * <p> 034 * When performing a simulation, each agent uses a state that represents the 035 * current state of the agent at the time indicated by the simulation 036 * environment. 037 * </p> 038 * 039 * <p> 040 * There is also a special breed of constraints (SimulationCritic) that react to 041 * simulation changes and display critiquing information during the simulation. 042 * </p> 043 * 044 * <p> 045 * These constraints as well as agent states share a common interface 046 * <code>SimulationElement</code> that the simulation engine uses when 047 * initializing the simulaiton and stepping forward and backward in time 048 * </p> 049 * 050 * @author olale 051 * 052 */ 053 public interface AgentSimulationState extends SimulationElement { 054 /** 055 * Enter property values to be used during the simulation 056 * 057 * @param key identifying this property 058 * @param value the value 059 */ 060 public <T> void setProperty(String key,T value); 061 062 /** 063 * 064 * There may be a number of properties associated with a state of an agent 065 * during a simulation. This method returns one based on the name and type 066 * of the property. Properties may be fuel level, current radar coverage or 067 * other information. 068 * 069 * @param <C> - 070 * The class of the value this property represents 071 * @param name 072 * of the property 073 * @param type 074 * of the property 075 * @return the value of property <code>name</code>, <code>null</code> 076 * if not available. 077 */ 078 public <C> C getProperty(String name, Class<C> type); 079 080 /** 081 * 082 * Render a visual representation of this agent state in the simulation 083 * view. This is one of the main purposes of a simulation: To see what the 084 * allocated resources will do over time during the simulation. 085 * 086 * @param view 087 * @param g2 088 */ 089 public void renderState(GeoView view, Graphics2D g2); 090 091 public Agent getAgent(); 092 }