com.miginfocom.util
Class KeySequence

java.lang.Object
  extended by com.miginfocom.util.KeySequence
All Implemented Interfaces:
java.io.Serializable

public class KeySequence
extends java.lang.Object
implements java.io.Serializable

A specific key sequence.

See Also:
Serialized Form

Constructor Summary
KeySequence()
          Constructor for an explicitly empty list
KeySequence(int key)
          Constructor for a single key.
KeySequence(int[] keys)
          Constructor.
KeySequence(java.util.List keyList)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares against another KeySequence.
 java.util.List getKeyList()
          Returns the sequence as an unmodifiable list with Integer object of the key codes.
 int[] getKeys()
          Returns the sequence as a number of keys.
 int hashCode()
          Depends on key AND their order.
 java.lang.String toString()
          A human readable representation of the sequence.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeySequence

public KeySequence()
Constructor for an explicitly empty list


KeySequence

public KeySequence(int key)
Constructor for a single key.

Parameters:
key - The key. E.g KeyEvent.VK_F or KeyEvent.VK_ENTER.

KeySequence

public KeySequence(int[] keys)
Constructor.

Parameters:
keys - The keys in the sequence. E.g KeyEvent.VK_F or KeyEvent.VK_ENTER.

KeySequence

public KeySequence(java.util.List keyList)
Constructor.

Parameters:
keyList - A list of the keys (Integers)in the sequence, will be cloned locally. E.g KeyEvent.VK_F or KeyEvent.VK_ENTER.
Method Detail

getKeyList

public java.util.List getKeyList()
Returns the sequence as an unmodifiable list with Integer object of the key codes.

Returns:
The sequence as an unmodifiable list. Never null.
See Also:
Collections.unmodifiableList(java.util.List)

getKeys

public int[] getKeys()
Returns the sequence as a number of keys.

Returns:
The sequence as a number of keys as a new array. Never null.

hashCode

public int hashCode()
Depends on key AND their order.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
A human readable representation of the sequence.

Overrides:
toString in class java.lang.Object
Returns:
A human readable representation of the sequence.

equals

public boolean equals(java.lang.Object o)
Compares against another KeySequence.

Overrides:
equals in class java.lang.Object
Parameters:
o - Another key sequence. If null false will be returned.
Returns:
If they are equal. Order matters here.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.