JACK 5.4 Application Interface

aos.jack.util.cursor
Class Change

java.lang.Object
  extended byaos.jack.jak.util.Watchable
      extended byaos.jack.jak.cursor.Cursor
          extended byaos.jack.util.cursor.Change
All Implemented Interfaces:
ObservableInt
Direct Known Subclasses:
Action

public class Change
extends Cursor

The Change class is a class that implements the necessary logic for a Cursor tied to Observable objects. A Change cursor is intended to be used in @wait_for statements, to block the condition testing until the Observable notifies. More exactly, the Change cursor makes the condition be triggered on a notification from the Observable. Thus, a conjunction of several Change cursors will be woken up by a notification from any of the Observables.


Field Summary
 
Fields inherited from class aos.jack.jak.cursor.Cursor
FALSE, falseCursor, TRUE, trueCursor, UNKNOWN
 
Constructor Summary
Change(java.util.Observable o)
          Constructs a Change Cursor to an Observable.
Change(java.util.Observable o, boolean initial)
          Constructs a Change Cursor to an Observable.
Change(Watchable w)
           
Change(Watchable w, boolean first)
           
 
Method Summary
protected  boolean condition()
          Determines whether the particular change has occurred.
 void finished()
          This informs the cursor that it is not going to be used again.
 boolean isTriggered()
          Returns true.
 boolean next()
          Used to test if the Observable has changed and if the condition is true.
 void register(java.util.Observer o)
           
 Cursor reset(aos.jack.jak.core.Generator g, int index)
          Resets the Cursor to its original state.
 void undo()
          Undo tells the cursor to backtrack anything it has done.
 boolean unRegister(java.util.Observer o)
           
 
Methods inherited from class aos.jack.jak.cursor.Cursor
negate
 
Methods inherited from class aos.jack.jak.util.Watchable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Change

public Change(java.util.Observable o,
              boolean initial)
Constructs a Change Cursor to an Observable. Allows the user to specify whether the cursor condition will be tested on first access.

Parameters:
o - The object to be observed
initial - Specifies whether to test the cursor condition on first access to the cursor.

Change

public Change(java.util.Observable o)
Constructs a Change Cursor to an Observable. The cursor condition will be tested on first access.

Parameters:
o - The object to be observed.

Change

public Change(Watchable w,
              boolean first)

Change

public Change(Watchable w)
Method Detail

isTriggered

public boolean isTriggered()
Returns true.

Overrides:
isTriggered in class Cursor

next

public boolean next()
Used to test if the Observable has changed and if the condition is true.

Specified by:
next in class Cursor
Returns:
True if a change has occurred and the condition is true, false otherwise.

condition

protected boolean condition()
Determines whether the particular change has occurred. User-code that extends Change may re-implement the condition() method to specialise for particular conditions. The default condition() method always returns true.


reset

public Cursor reset(aos.jack.jak.core.Generator g,
                    int index)
Resets the Cursor to its original state. This method is called by the JACK kernel prior to calling next().

Overrides:
reset in class Cursor
Parameters:
g - The generator that generates an equivalent cursor
index - The index of the equivalent cursor in the generator.
Returns:
The reset cursor, or an equivalent one.

undo

public void undo()
Description copied from class: Cursor
Undo tells the cursor to backtrack anything it has done. It is a subset of the reset() functionality since it does not reinitialize the cursor. The only requirement is that any bindings made by the cursor are undone. The state of the cursor after the call is undefined. Most implementations will fail if next() is called after undo() without an intervening call to reset().

Overrides:
undo in class Cursor

finished

public void finished()
Description copied from class: Cursor
This informs the cursor that it is not going to be used again. This is typically used to clean up data strutures and to remove itself from any notification paths.

Overrides:
finished in class Cursor

register

public void register(java.util.Observer o)
Overrides:
register in class Cursor

unRegister

public boolean unRegister(java.util.Observer o)
Overrides:
unRegister in class Cursor

JACK 5.4 Application Interface

Copyright (C) 1999-2008, Agent Oriented Software Pty. Ltd.

US Government Restricted Rights
The JACK Modules and relevant Software Material have been developed entirely at private expense and are accordingly provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013 or subparagraph (c)(1) and (2) of the Commercial Computer Software Restricted Rights and 48 CFR 52.2270-19, as applicable.


Agent Oriented Software Pty. Ltd.     http://www.aosgrp.com
PO Box 639, Carlton South, Victoria 3053, Australia
Phone: +61 3 9349 5055, Fax: +61 3 9349 5088