sdljava.event
Class SDLMod

java.lang.Object
  extended by sdljava.event.SDLMod

public class SDLMod
extends java.lang.Object

Set of possible key modifiers(mods)

Version:
$Id: SDLMod.java,v 1.8 2005/01/19 03:09:12 ivan_ganza Exp $
Author:
Ivan Z. Ganza

Field Summary
(package private) static java.util.Map modCache
          cache of SDLMod instances, one for each possible mods values
(package private)  int mods
          valid key mods (possibly OR'd together)
 
Constructor Summary
SDLMod(int mods)
          Creates a new SDLMod instance.
 
Method Summary
 boolean alt()
           
 boolean caps()
           
 boolean ctrl()
           
static SDLMod get(int mods)
          Get the SDLMod instance identified by mods.
 int getState()
           
 boolean leftAlt()
           
 boolean leftCtrl()
           
 boolean leftMeta()
           
 boolean leftShift()
           
 boolean meta()
           
 boolean mode()
           
 boolean num()
           
 boolean rightAlt()
           
 boolean rightCtrl()
           
 boolean rightMeta()
           
 boolean rightShift()
           
 boolean shift()
           
 java.lang.String toString()
           
 java.lang.String toStringBrief()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

modCache

static java.util.Map modCache
cache of SDLMod instances, one for each possible mods values


mods

int mods
valid key mods (possibly OR'd together)

Constructor Detail

SDLMod

public SDLMod(int mods)
Creates a new SDLMod instance.

Parameters:
mods - valid key mods (possibly OR'd together)
Method Detail

get

public static SDLMod get(int mods)
Get the SDLMod instance identified by mods. This method creates the SDLMod instance and caches it if it didn't already exist. Once created we won't need to create new SDLMod object instances each time a keyboard event occurs.

Parameters:
mods - valid key mods (possibly OR'd together)
Returns:
The singleton SDLMod instance

leftShift

public boolean leftShift()

rightShift

public boolean rightShift()

leftCtrl

public boolean leftCtrl()

rightCtrl

public boolean rightCtrl()

leftAlt

public boolean leftAlt()

rightAlt

public boolean rightAlt()

leftMeta

public boolean leftMeta()

rightMeta

public boolean rightMeta()

num

public boolean num()

caps

public boolean caps()

mode

public boolean mode()

ctrl

public boolean ctrl()

shift

public boolean shift()

alt

public boolean alt()

meta

public boolean meta()

getState

public int getState()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringBrief

public java.lang.String toStringBrief()