frysk.rt
Class UpdatingDisplayValue

java.lang.Object
  extended by frysk.rt.DisplayValue
      extended by frysk.rt.UpdatingDisplayValue

public class UpdatingDisplayValue
extends DisplayValue

An UpdatingDisplayValue is nearly identical to a DisplayValue, except that an UpdatingDisplayValue is provided with additional information that enables it to automatically refresh itself whenever the task given to it changes state. Objects can be notified of updates by using the addObserver method.


Nested Class Summary
private  class UpdatingDisplayValue.LockObserver
           
private  class UpdatingDisplayValue.TermObserver
           
 
Field Summary
private  boolean enabled
           
private  SteppingEngine engine
           
private  UpdatingDisplayValue.LockObserver lock
           
private  List observers
           
private  byte[] oldValue
           
private  UpdatingDisplayValue.TermObserver term
           
 
Fields inherited from class frysk.rt.DisplayValue
frameIdentifier, myTask, myVar, num, varLabel
 
Constructor Summary
UpdatingDisplayValue(String name, Task task, FrameIdentifier fIdent, SteppingEngine eng, int id)
          Crate a new UpdatingDisplayValue
 
Method Summary
 void addObserver(DisplayValueObserver obs)
          Adds an observer to listen for changes to this DisplayValue
protected  boolean arrayChanged(byte[] newArray)
           
 void disable()
          Disables the display, stopping all notification of changes to the underlying expression.
 void enable()
          Re-enables the display, resuming notification of events to all observers
 boolean equals(Object other)
           
 boolean isEnabled()
          Check if this display is enabled or not.
protected  void notifyObserversAvailable()
           
protected  void notifyObserversDisabled()
           
protected  void notifyObserversUnavailableOutOfScope()
           
protected  void notifyObserversUnavailableTaskResumed()
           
protected  void notifyObserversValueChanged()
           
 void refresh()
          Updates the display to refect the new variable value
 boolean removeObserver(DisplayValueObserver obs)
          Removes the given observer from the list of observers
 
Methods inherited from class frysk.rt.DisplayValue
getFrameIdentifier, getId, getName, getTask, getValue, isAvailable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

engine

private SteppingEngine engine

observers

private List observers

oldValue

private byte[] oldValue

lock

private UpdatingDisplayValue.LockObserver lock

term

private UpdatingDisplayValue.TermObserver term

enabled

private boolean enabled
Constructor Detail

UpdatingDisplayValue

UpdatingDisplayValue(String name,
                     Task task,
                     FrameIdentifier fIdent,
                     SteppingEngine eng,
                     int id)
Crate a new UpdatingDisplayValue

Parameters:
name - The name of the variable to track
task - The task from which to track the variable
fIdent - The frame identifier corresponding to the scope from which the variable should be read
eng - The stepping engine to monitor for changes in execution state
id - The unique id for this display
Method Detail

refresh

public void refresh()
Description copied from class: DisplayValue
Updates the display to refect the new variable value

Overrides:
refresh in class DisplayValue

addObserver

public void addObserver(DisplayValueObserver obs)
Adds an observer to listen for changes to this DisplayValue

Parameters:
obs - The new observer to be notified

removeObserver

public boolean removeObserver(DisplayValueObserver obs)
Removes the given observer from the list of observers

Parameters:
obs - The observer to remove
Returns:
True if obs was found and removed, false otherwise

equals

public boolean equals(Object other)
Overrides:
equals in class Object

disable

public void disable()
Disables the display, stopping all notification of changes to the underlying expression.


enable

public void enable()
Re-enables the display, resuming notification of events to all observers


isEnabled

public boolean isEnabled()
Check if this display is enabled or not. A disabled display will not send any notifications regarding changes to the value of the watched expression.

Returns:
True iff this display is enabled, false otherwise

notifyObserversAvailable

protected void notifyObserversAvailable()

notifyObserversUnavailableTaskResumed

protected void notifyObserversUnavailableTaskResumed()

notifyObserversValueChanged

protected void notifyObserversValueChanged()

notifyObserversUnavailableOutOfScope

protected void notifyObserversUnavailableOutOfScope()

notifyObserversDisabled

protected void notifyObserversDisabled()

arrayChanged

protected boolean arrayChanged(byte[] newArray)