View Javadoc

1   /**
2    * Emohawk Bot, an implementation of the environment interface standard that 
3    * facilitates the connection between GOAL and Emohawk. 
4    * 
5    * Copyright (C) 2012 Emohawk Bot authors.
6    * 
7    * This program is free software: you can redistribute it and/or modify it under
8    * the terms of the GNU General Public License as published by the Free Software
9    * Foundation, either version 3 of the License, or (at your option) any later
10   * version.
11   * 
12   * This program is distributed in the hope that it will be useful, but WITHOUT
13   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14   * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15   * details.
16   * 
17   * You should have received a copy of the GNU General Public License along with
18   * this program. If not, see <http://www.gnu.org/licenses/>.
19   */
20  package nl.tudelft.goal.emohawk.translators;
21  
22  import nl.tudelft.goal.EIS2Java.exception.TranslationException;
23  import nl.tudelft.goal.EIS2Java.translation.Java2Parameter;
24  import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Game;
25  import eis.iilang.Identifier;
26  import eis.iilang.Numeral;
27  import eis.iilang.Parameter;
28  
29  public class GameTranslator implements Java2Parameter<Game> {
30  
31  	@Override
32  	public Parameter[] translate(Game o) throws TranslationException {
33  
34  		// gameinfo(<Gametype>, <Map>, <GoalScore>, <timeLimit>)
35  		return new Parameter[] { new Identifier(o.getGameType().name()), new Identifier(o.getMapName()),
36  				new Identifier(o.getMapName()), new Numeral(o.getTeamScoreLimit()), new Numeral(o.getRemainingTime()) };
37  	}
38  
39  	@Override
40  	public Class<? extends Game> translatesFrom() {
41  		return Game.class;
42  	}
43  
44  }