/* $Id$
 *
 * Copyright (c) 1999 Xenonsoft Limited. All Rights Reserved.
 *
 * This software is protected by copyright. You are hereby notified from
 * now by reading this message. This software is also the confidential 
 * and proprietary information of Xenonsoft Limited.  ("Confidential
 * Information"). 
 *
 * This software is distributed under the Xenonsoft Public end user 
 * License ("XPeL"), where the machine-readable source code is provided 
 * under the "Open Source" model.
 * For more information, please read the file "LICENSE-XPL.txt" 
 */

// File:`UserKeyTuple.java'
//
//
// DESCRIPTION
//	User Defined Key tuple
// 
// Author
//
//	Peter Pilgrim
//	Wed Aug 04 23:20:47 BST 1999
// 
// RCS HEADER ``UserKeyTuple.java''
// 
//	$Author$
//	$Date$
//	$Revision$    $State$    $Locker$
//

package xenon.gamekit;

import java.io.Serializable;

/**
 * An objects that maintains a user defined key mapping
 * 
 * @author Peter Pilgrim, Wed Aug 04 23:24:36 BST 1999
 * @version $Id$
 */
public class UserKeyTuple implements Serializable, Cloneable
{
    /** The user defined key description */
    public String	keyDescrip;

    /** The current key code setting */
    public int		keyCode;

    /** The default key code */
    public int		defKeyCode;
    /** 
     * constructs a tuple for a user defined key with the same
     * initial key code as the default key code.
     * @param keyDescrip the key description.
     * @param defKeyCode the default key code.
     */
    public UserKeyTuple( String keyDescrip, int defKeyCode )
    {
	this( keyDescrip, defKeyCode, defKeyCode );
    }
    

    /** 
     * constructs a tuple for a user defined key.
     * @param keyDescrip the key description.
     * @param keyCode the key code.
     * @param defKeyCode the default key code.
     */
    public UserKeyTuple( String keyDescrip, int keyCode, int defKeyCode )
    {
	this.keyDescrip = keyDescrip;
	this.keyCode    = keyCode;
	this.defKeyCode = defKeyCode;
    }
    
    /** sets the key description */
    public void setKeyDescription( String descrip )
    {
	keyDescrip = descrip;
    }
    
    /** gets the player's name */
    public String getKeyDescription()
    {
	return (keyDescrip);
    }
    
    /** sets the key code */
    public void setKeyCode( int keycode )
    {
	this.keyCode = keycode;
    }
    
    /** gets the key code */
    public int getKeyCode()
    {
	return (keyCode);
    }
    
    /** sets the default key code */
    public void setDefaultKeyCode( int keycode )
    {
	this.defKeyCode = keycode;
    }
    
    /** gets the default key code */
    public int getDefaultKeyCode()
    {
	return (defKeyCode);
    }
    
    /** create a clone of this score tuple */
    public Object clone() 
    {
	try {
	    return super.clone();
	}
	catch ( CloneNotSupportedException e ) {
	    throw new Error("Can't Clone: this should never happen!");
	}
    }
    
    public String toString() 
    {
	return "{"+keyDescrip+", "+keyCode+", "+defKeyCode+" }";
    }
}

// fini
