com.tensegrity.graphics
Class CursorRegistry

java.lang.Object
  extended bycom.tensegrity.graphics.CursorRegistry

public final class CursorRegistry
extends java.lang.Object

The CursorRegistry class is used to work with cursors.

A cursor is registered to the CursorRegistry with a key object so that it can be accessed later on with this key.
The cursor itself is treated as an Object in order to stay independent from a certain window toolkit.

Version:
$Id: CursorRegistry.java,v 1.2 2005/04/01 15:42:39 MichaelKegel Exp $
Author:
MKegel

Constructor Summary
CursorRegistry()
          Constructor for CursorRegistry.
CursorRegistry(CursorRegistry registry)
          Copy contructor for CursorRegistry.
 
Method Summary
 void clear()
          Unregisters all registered cursors from the registry such that it is empty afterwards.
 boolean containsCursor(java.lang.Object cursor)
          Returns a boolean that indicates whether the given cursor (repectively cursor identifier) is registered at the registry or not.
 boolean containsKey(java.lang.Object key)
          Returns a boolean that indicates whether a cursor with the given key is registered at the registry or not.
 java.util.Iterator cursorIterator()
           Returns an Iterator that can be use to iteratr over the currently registered cursors (or cursor identifier).
 CursorRegistry deepCopy()
           
 java.lang.Object get(java.lang.Object key)
           Returns the cursor (or cursor identifier) that for the given key.
 boolean isEmpty()
          Returns a boolean that indicates whether the registry is emty or not.
 java.util.Iterator keyIterator()
           Returns an Iterator that can be used to iterate over the keys of the currently registered cursors (or cursor identifier).
 void register(java.lang.Object key, java.lang.Object cursor)
           Registers the given cursor (or cursor indentigier) with the given key at the registry.
 int size()
          Returns the current amoung of registered cursors.
 void unregister(java.lang.Object key)
           Unregisters (repectively removes) the cursor (or cursor identifier) that is registered with the given key from the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CursorRegistry

public CursorRegistry()
Constructor for CursorRegistry.


CursorRegistry

public CursorRegistry(CursorRegistry registry)
Copy contructor for CursorRegistry.

Parameters:
registry - the CursorRegistry to copy
Method Detail

isEmpty

public boolean isEmpty()
Returns a boolean that indicates whether the registry is emty or not.

Returns:
boolean flag that indicates whether the registry is empty or not

containsKey

public boolean containsKey(java.lang.Object key)
Returns a boolean that indicates whether a cursor with the given key is registered at the registry or not.

Parameters:
key - to check for
Returns:
boolean flag that indicates whether a cursor for the key is registered or not

containsCursor

public boolean containsCursor(java.lang.Object cursor)
Returns a boolean that indicates whether the given cursor (repectively cursor identifier) is registered at the registry or not.

Parameters:
cursor - the cursor (or cursor identifier) to check for
Returns:
boolean a flag that indicates whether the given cursor (or cursor identifier) is registered or not

size

public int size()
Returns the current amoung of registered cursors.

Returns:
int the current count of cursors

register

public void register(java.lang.Object key,
                     java.lang.Object cursor)

Registers the given cursor (or cursor indentigier) with the given key at the registry. This registered cursor can be accessed later on by the given key.

If there is already a cursor registered for the given key it will be replaced by a call to this method.

Parameters:
key - for the given cursor
cursor - the cursor (or curor identifier) to register

unregister

public void unregister(java.lang.Object key)

Unregisters (repectively removes) the cursor (or cursor identifier) that is registered with the given key from the registry.

If there is no cursor with the given key registered at the registry the methods does nothing.

Parameters:
key - the key of the cursor (or cursor identifier) to unregister from the registry

get

public java.lang.Object get(java.lang.Object key)

Returns the cursor (or cursor identifier) that for the given key.

If no cursor is registered for the given key this method returns null.

Parameters:
key - the key of the cursor (or cursor identifier) to unregister from the registry
Returns:
the cursor (or cursor identifier) instance

clear

public void clear()
Unregisters all registered cursors from the registry such that it is empty afterwards.


keyIterator

public java.util.Iterator keyIterator()

Returns an Iterator that can be used to iterate over the keys of the currently registered cursors (or cursor identifier).

The returned iterator does not allow to remove a cursor from the registry.

Returns:
iterator to iterate over the keys of the registered cursors

cursorIterator

public java.util.Iterator cursorIterator()

Returns an Iterator that can be use to iteratr over the currently registered cursors (or cursor identifier).

The returned iterator does not allow to remove a cursor from the registry.

Returns:
iterator to iterate over the the registered cursors

deepCopy

public CursorRegistry deepCopy()


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.