001 package controller; 002 003 import model.ILambda; 004 import sysModel.ICmdFactory; 005 import sysModel.ISecurityAdapter; 006 import sysModel.env.AEnvFactory; 007 008 import java.awt.*; 009 010 /** 011 * Adapter to connect the environment controls and the model. 012 * 013 * @author Mathias Ricken 014 */ 015 public interface IEnvAdapter { 016 /** 017 * Load environment from file. 018 * 019 * @param filename filename 020 * 021 * @return true if successful 022 */ 023 boolean loadEnvironment(String filename); 024 025 /** 026 * Save environment to file. 027 * 028 * @param filename filename 029 * 030 * @return true if successful 031 */ 032 boolean saveEnvironment(String filename); 033 034 /** 035 * Create environment from factory. 036 * 037 * @param factory factory 038 * 039 * @return true if successful 040 */ 041 boolean createEnvironment(AEnvFactory factory); 042 043 /** 044 * Set the seed command. This command gets executed before a new environment is created or loaded. 045 * 046 * @param seedCmd command to set 047 */ 048 void setSeedLambda(ILambda seedCmd); 049 050 /** 051 * Edit a field. 052 * 053 * @param p mouse coordinates 054 * @param button mouse button pressed 055 */ 056 void edit(Point.Double p, int button); 057 058 /** 059 * Get a tool tip description for a specific place in the environment. 060 * 061 * @param p mouse coordinates 062 * 063 * @return tool tip text 064 */ 065 String getToolTipText(Point.Double p); 066 067 /** 068 * Return an array of environment class names to be loaded at startup. 069 * 070 * @return array of class names 071 */ 072 String[] getEnvironmentClassNames(); 073 074 /** 075 * Return an array of fish class names to be loaded at startup. 076 * 077 * @return array of class names 078 */ 079 String[] getFishClassNames(); 080 081 /** 082 * Return the factory to make commands for the simulation driver. 083 * 084 * @return command factory 085 */ 086 ICmdFactory getCmdFactory(); 087 088 /** 089 * Return the security adapter. 090 * 091 * @return security adapter 092 */ 093 ISecurityAdapter getSecurityAdapter(); 094 }