Source code for /engineering/autohit-2003/src/autohit/call/Call_UNIQUE_INT.javaOriginal file Call_UNIQUE_INT.java
   1 /**
   2  * AUTOHIT 2003
   3  * Copyright Erich P Gatejen (c) 1989,1997,2003,2004
   4  * 
   5  * This program is free software; you can redistribute it and/or modify 
   6  * it under the terms of the GNU General Public License as published by 
   7  * the Free Software Foundation; either version 2 of the License, or (at
   8  * your option) any later version.
   9  * This program is distributed in the hope that it will be useful, but
  10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12  * more details.
  13  * 
  14  * You should have received a copy of the GNU General Public License along
  15  * with this program; if not, write to the Free Software Foundation, Inc.,
  16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17  *
  18  * Additional license information can be found in the documentation.
  19  * @author Erich P Gatejen
  20  */
  21 package autohit.call;
  22 
  23 import autohit.universe.Universe;
  24 
  25 /**
  26  * UNIQUE_INT call.  Returns unique integer.  It is unique to the SystemContext.
  27  * It is as a suitable unique ID for core items.
  28  * <pre>
  29  * REQURIES: logger
  30  * IGNORES: uni, core
  31  * </pre>
  32  *
  33  * @author Erich P. Gatejen
  34  * @version 1.0
  35  * <i>Version History</i>
  36  * <code>EPG - Initial - 30Jul03 
  37  * 
  38  */
  39 public class Call_UNIQUE_INT extends Call {
  40 
  41 	/**
  42 	 * Implement this to handle load time initialization.  The 
  43 	 * four main fields will already be set--vmc, sc, log, and u.
  44 	 * You must implement this, but you don't have to do anything.
  45 	 * Remember that calls are cached per VM and reused as often
  46 	 * as possible.  There will be no thread-safety issues with the
  47 	 * VMCore or log, but the SystemContecxt and Universe may be shared.
  48 	 * @throws CallException
  49 	 */
  50 	public void load_chain() throws CallException {
  51 		// Nothing to do.
  52 	}
  53 
  54 	/**
  55 	 * Implement this to return the name of the CALL
  56 	 * @return name of the CALL
  57 	 */
  58 	public String name() {
  59 		return "UNIQUE_INT";
  60 	}
  61 
  62 	/**
  63 	 * Execute it.
  64 	 * @return the result or null if there is no result
  65 	 */
  66 	public String call() throws CallException {
  67 		String val = Integer.toString(sc.uniqueInteger());
  68 		this.debug("returned=" + val);
  69 		return val;
  70 	}
  71 
  72 	/**
  73 	 * Execute using the passed universe, rather than the loaded.
  74 	 * @param uni a universe
  75 	 * @return the result or null if there is no result
  76 	 * @see autohit.universe.Universe
  77 	 */
  78 	public String call(Universe uni) throws CallException {
  79 		return this.call();
  80 	}
  81 }