dasher
Class CDasherModel

java.lang.Object
  extended by dasher.CDasherComponent
      extended by dasher.CDasherModel

public class CDasherModel
extends CDasherComponent

Dasher 'world' data structures and dynamics.

The DasherModel represents the current state of Dasher. It contains a tree of DasherNodes, knows the current viewpoint and knows how to evolve the viewpoint.

It also plays host to the LanguageModel, being responsible for its creation and passing some requests to it from external components.

The Model does not know how to draw Dasher; this is the responsibility of a DasherView.


Nested Class Summary
(package private)  class CDasherModel.CTrainer
          Helper class to assist in training of the language model.
(package private)  class CDasherModel.GNRCReturn
          Simple struct for returning min/max pairs.
(package private)  class CDasherModel.SGotoItem
          Simple struct recording a point to which we are scheduled to zoom.
 
Field Summary
protected  long ControlSpace
          Probability assinged to the Control Node
protected  CContextBase LearnContext
          Our current prediction context.
protected  CAlphabetManagerFactory m_AlphabetManagerFactory
          Our alphabet manager, for functions which require knowledge of an Alphabet.
 boolean m_bContextSensitive
          Are the current model's predictions dependent on our context?
protected  CAlphabet m_cAlphabet
          Alphabet used by this Model
 CDasherInterfaceBase m_DasherInterface
          The Interface to which this Model belongs.
protected  java.util.LinkedList<CDasherModel.SGotoItem> m_deGotoQueue
          List of points which we are to go to before responding to user input again.
protected  double m_dMaxRate
          The probability that gets added to every symbol
protected  CFrameRate m_fr
          Framerate tracker
protected  long m_iTargetMax
          Next upper bound which NewGoto will make the upper edge of the viewport on its next call.
protected  long m_iTargetMin
          Next lower bound which NewGoto will make the lower edge of the viewport on its next call.
protected  CLanguageModel m_LanguageModel
          LanguageModel used by this Model for prediction.
protected  CDasherNode m_Root
          Node which is currently root of the Node tree.
protected  long m_Rootmax
          Root node's upper bound in Dasher world co-ordinates
protected  long m_Rootmax_max
          Maximum allowable value of m_Rootmax
protected  long m_Rootmin
          Root node's lower bound in Dasher world co-ordinates
protected  long m_Rootmin_min
          Minimum allowable value of m_Rootmin
protected  int m_Stepnum
          Number of interpolated steps to use in Click Mode.
protected  java.util.LinkedList<CDasherNode> oldroots
          List of previous roots, to which we may revert if the user backs off sufficiently.
protected  double total_nats
          Record of 'amount of information' entered so far, for logging purposes.
protected  int uniformAdd
          Amount to add to all symbols' probabilities, in order to avoid a zero probability.
 
Fields inherited from class dasher.CDasherComponent
m_EventHandler, m_SettingsStore
 
Constructor Summary
CDasherModel(CEventHandler EventHandler, CSettingsStore SettingsStore, CDasherInterfaceBase DashIface, CAlphIO AlphIO)
          Initialise a new DasherModel.
 
Method Summary
 void adjustProbs(long[] probs)
          Increments all probabilities by the value of uniformAdd, and sets the final probability to ControlSpace.
 boolean CheckForNewRoot(CDasherView View)
          If the view reports that our current root node isn't visible, calls Reparent_root; if only one child of the current root is Alive (ie.
protected  void ClearRootQueue()
          Forget about the queue of old root nodes.
 void ConnectNode(int iChild, int iParent, int iAfter)
          Stub; implement if Control Mode is required.
protected  double CorrectionFactor(long dasherx, long dashery)
          TODO work out what this does and document.
protected  CContextBase CreateEmptyContext()
          Deferred to m_LanguageModel
protected  boolean DeleteCharacters(CDasherNode newnode, CDasherNode oldnode)
          Traces back from oldnode to either a) newnode, in the case that oldnode is a descendent of newnode, or b) to the nearest common ancestor (ie.
 void deleteLM()
          Runs the LanguageModel's UnregisterComponent method, if there is currently a LanguageModel.
 void DisconnectNode(int iChild, int iParent)
          Stub; implement if Control Mode is required.
 void EnterText(CContextBase context, java.lang.String TheText)
          Extends a given language model context without modifying the model itself.
 double Framerate()
          Deferred to m_fr.
protected  CDasherModel.GNRCReturn Get_new_root_coords(long Mousex, long Mousey)
          Calculate the new co-ordinates for the root node after a single update step.
protected  CDasherNode Get_node_under_crosshair()
           
protected  CDasherNode Get_node_under_mouse(long Mousex, long Mousey)
          Gets the node under the current mouse position.
 CAlphabet GetAlphabet()
          Retrieves our current alphabet.
 CAlphabet GetAlphabetNew()
          Retrieves our current alphabet.
 int GetColour(int s)
          Deferred to m_cAlphabet
 java.util.ArrayList<java.lang.Integer> GetColours()
          Deferred to m_cAlphabet
protected  long getControlSpace(int iNorm)
          Gets the probability to associate with the control node
 int GetControlSymbol()
          Gets our current alphabet's Control symbol
 java.lang.String GetDisplayText(int iSymbol)
          Deferred to m_cAlphabet
 double GetNats()
          Gets total_nats
 int getNonUniformNorm(int iNorm)
          Calculates the non-uniform norm.
 long[] GetProbs(CContextBase context, int iNorm)
          Requests node probabilities from the language model given a context and a normalization value (usually LP_NORMALIZATION).
 CDasherNode GetRoot(int iType, CDasherNode Parent, long iLower, long iUpper, int UserData)
          Constructs a new root Node of a given type, with a given parent which may be null if necessary.
 int GetSpaceSymbol()
          Gets our current alphabet's Space symbol
 int GetStartConversionSymbol()
          Gets our current alphabet's Start-conversion symbol
 CDasherModel.CTrainer GetTrainer()
          Gets this model's helper training class.
protected  int getUniformAdd(int iNorm)
          Calculates a value to add to all probabilities before use, preventing any zero values from being used and potentially resulting in missing nodes.
 void Halt()
          Deferred to m_fr.Initialise().
 void HandleEvent(CEvent Event)
          The Model responds to the following events:
protected  void HandleOutput(CDasherNode NewNode, CDasherNode OldNode)
          Handles output based on the nodes which were under the crosshair before and after a move.
 void LearnText(CContextBase context, java.lang.String TheText, boolean IsMore)
          Extends a given context with a given string of characters, whilst modifying the language model itself based on what is entered.
protected  void Make_root(CDasherNode whichchild)
          Makes a specified child the new root node, deleting all of its siblings (by virtue of instructing its parent, the current root, to DeleteNephews.
protected  void MatchTarget()
          Sets each of RootMin and RootMax to match their TargetMax and TargetMin partners.
 void NewFrame(long Time)
          Deferred to m_fr.
protected  void NewGoTo(long newRootmin, long newRootmax)
          Changes the state of the Model updating the values of m_RootMax and m_RootMin, which has the effect of making us appear to move around.
 void Offset(int iOffset)
          Sets each of Rootmin and Rootmax to TargetMin and TargetMax plus a given offset.
protected  void OldPush(long iMousex, long iMousey)
          Expands sections of the node tree, using random point selection and the Get_node_under method to try to bias the process in favour of larger nodes.
protected  void Push_Node(CDasherNode Node)
          Deletes and then repopulates the children of a given node.
protected  void RebuildAroundNode(CDasherNode Node)
          Makes a given Node the root, and then deletes and rebuilds its children.
protected  void Recursive_Push_Node(CDasherNode Node, int iDepth)
          Pushes a given node and recursively pushes its children to a given depth.
protected  void RecursiveMakeRoot(CDasherNode NewRoot)
          Calls Make_root repeatedly to make a specified node the new root node.
protected  void RecursiveOutput(CDasherNode Node, java.util.ArrayList<CSymbolProb> pAdded)
          Given a Node which is supposed to be the current end of output, recursively checks whether the parent's Seen property is true (which indicates it has been output if appropriate) and invokes the AlphabetManager's Enter and Output methods on each unseen ancestor in tree-descending order.
 void RegisterNode(int iID, java.lang.String strLabel, int iColour)
          Stub; implement if Control Mode is required.
 boolean RenderToView(CDasherView View, boolean bRedrawDisplay)
          Calls the View's Render method on our current Root; the View will take care of all drawing from here on in.
protected  void Reparent_root(long lower, long upper)
          Reconstructs the existing root's parent, so that we can back out of it.
 void Reset_framerate(long Time)
          Deferred to m_fr.
 void ResetNats()
          Sets total_nats back to 0.
 int ScheduledSteps()
          Retrieves the number of points currently in the m_deGotoQueue.
 void ScheduleZoom(long dasherx, long dashery)
          Interpolates between our current position and a given new position, scheduling a zoom to the new position by adding the interpolated points to m_deGotoQueue.
 void SetBitrate(double TargetRate)
          Deferred to m_fr.
 void SetContext(java.lang.String sNewContext)
          Forces the current context to a given value, and resets our position in the Dasher world based upon it.
 void Start()
          Sets a blank context.
 boolean Tap_on_display(long miMousex, long miMousey, long Time, java.util.ArrayList<CSymbolProb> pAdded)
          Performs a single update of the model based on a given mouse position and the time elpased since the last update took place.
 void UnregisterComponent()
          Unregisters the language model and then ourselves.
 
Methods inherited from class dasher.CDasherComponent
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, InsertEvent, SetBoolParameter, SetLongParameter, SetStringParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_bContextSensitive

public boolean m_bContextSensitive
Are the current model's predictions dependent on our context?

In reality almost all models are context sensitive.


m_DasherInterface

public CDasherInterfaceBase m_DasherInterface
The Interface to which this Model belongs.


m_LanguageModel

protected CLanguageModel m_LanguageModel
LanguageModel used by this Model for prediction.


m_cAlphabet

protected CAlphabet m_cAlphabet
Alphabet used by this Model


LearnContext

protected CContextBase LearnContext
Our current prediction context.


m_Root

protected CDasherNode m_Root
Node which is currently root of the Node tree.


oldroots

protected java.util.LinkedList<CDasherNode> oldroots
List of previous roots, to which we may revert if the user backs off sufficiently.


m_Rootmin

protected long m_Rootmin
Root node's lower bound in Dasher world co-ordinates


m_Rootmax

protected long m_Rootmax
Root node's upper bound in Dasher world co-ordinates


m_iTargetMin

protected long m_iTargetMin
Next lower bound which NewGoto will make the lower edge of the viewport on its next call.


m_iTargetMax

protected long m_iTargetMax
Next upper bound which NewGoto will make the upper edge of the viewport on its next call.


m_Rootmin_min

protected long m_Rootmin_min
Minimum allowable value of m_Rootmin


m_Rootmax_max

protected long m_Rootmax_max
Maximum allowable value of m_Rootmax


m_fr

protected CFrameRate m_fr
Framerate tracker


total_nats

protected double total_nats
Record of 'amount of information' entered so far, for logging purposes.


m_dMaxRate

protected double m_dMaxRate
The probability that gets added to every symbol


m_Stepnum

protected int m_Stepnum
Number of interpolated steps to use in Click Mode.

See Also:
CClickFilter

m_AlphabetManagerFactory

protected CAlphabetManagerFactory m_AlphabetManagerFactory
Our alphabet manager, for functions which require knowledge of an Alphabet.


m_deGotoQueue

protected java.util.LinkedList<CDasherModel.SGotoItem> m_deGotoQueue
List of points which we are to go to before responding to user input again.


uniformAdd

protected int uniformAdd
Amount to add to all symbols' probabilities, in order to avoid a zero probability.


ControlSpace

protected long ControlSpace
Probability assinged to the Control Node

Constructor Detail

CDasherModel

public CDasherModel(CEventHandler EventHandler,
                    CSettingsStore SettingsStore,
                    CDasherInterfaceBase DashIface,
                    CAlphIO AlphIO)
Initialise a new DasherModel. This consists of:

This does not train the newly created language model; this must be requested from outside, typically by the Interface.

Parameters:
EventHandler - Event handler with which to register ourselves
SettingsStore - Settings repository
DashIface - Interface which we serve
AlphIO - AlphIO object from which to retrieve the AlphInfo object describing the user's chosen alphabet
Method Detail

HandleEvent

public void HandleEvent(CEvent Event)
The Model responds to the following events:

LP_MAX_BITRATE: Informs the CFrameRate which performs frame rate tracking for us of the new frame rate.

BP_CONTROL_MODE: Rebuilds the model (calls RebuildAroundNode) to include/exclude a control node.

BP_DELAY_VIEW: Sets the TargetMax to match RootMax and similarly RootMin.

LP_UNIFORM: Updates our internally cached value (uniformAdd) to reflect the new value.

Overrides:
HandleEvent in class CDasherComponent
Parameters:
Event - Event received.

Make_root

protected void Make_root(CDasherNode whichchild)
Makes a specified child the new root node, deleting all of its siblings (by virtue of instructing its parent, the current root, to DeleteNephews.

This function does not make any checks that the specified Node really is a child of the current root, or that we are in a sensible position to redefine the root; the behaviour if this is not ensured before calling is undefined.

The former root node will be added to oldroots, in case we need to recover it in future.

m_RootMax, m_TargetMax and their brethren are also updated to take into account the new root's Hbnd and Lbnd values.

Due to this function's lack of checks made on the validity of the requested operation, it is recommended to use RecursiveMakeRoot instead where possible.

Parameters:
whichchild - Child to make the new root node.

ClearRootQueue

protected void ClearRootQueue()
Forget about the queue of old root nodes.

This should be called when the previous context is no longer valid.


RecursiveMakeRoot

protected void RecursiveMakeRoot(CDasherNode NewRoot)
Calls Make_root repeatedly to make a specified node the new root node.

This function must be called on some descendent of the current root.

Behaviour if called upon a node which is not is undefined; most likely it would eventually run into a node whose parent has been deleted, and fail with a NullPointerException.

Parameters:
NewRoot - Node to make the root.

RebuildAroundNode

protected void RebuildAroundNode(CDasherNode Node)
Makes a given Node the root, and then deletes and rebuilds its children.

This is intended for situations when an existing Node has children which are no longer correct; for instance, if Control Mode has been switched on necessitating a new child Node, or if the language model has been changed.

The specified Node must be a descendent of the existing root, or RecursiveMakeRoot will fail to find a link between the two.

Parameters:
Node - New root node after the rebuild.

Reparent_root

protected void Reparent_root(long lower,
                             long upper)
Reconstructs the existing root's parent, so that we can back out of it.

This will first try to use an old Node stored in the oldroots list, but if this is empty will use the AlphabetManager's RebuildParent method to instantiate a new parent.

If unsuccessful in building a parent, or if the current root is the base node in which Dasher starts, the method will return without performing any action.

m_RootMax, m_TargetMax and their brethren will also be appropriately updated.

Parameters:
lower - Current root's Lbnd
upper - Current root's Hbnd

Get_node_under_crosshair

protected CDasherNode Get_node_under_crosshair()

Get_node_under_mouse

protected CDasherNode Get_node_under_mouse(long Mousex,
                                           long Mousey)
Gets the node under the current mouse position.

Parameters:
Mousex - Current mouse x co-ordinate
Mousey - Current mouse y co-ordinate
Returns:
Reference to Node under mouse

Start

public void Start()
Sets a blank context. This method could use some work; it looks as if it tries to request any known context from the UI using an EditContextEvent, but this doesn't work at present.

This ought not to matter as SetContext fulfils this purpose with a given context, and so can duplicate the function of Start by passing it the empty string.


SetContext

public void SetContext(java.lang.String sNewContext)
Forces the current context to a given value, and resets our position in the Dasher world based upon it.

If the given context is empty, the context is actually set to ". " so that the prediction is the same as for the beginning of a new sentence.

Internally, this works by requesting a new Root node from the Alphabet Manager, creating a blank context, and training it using the supplied String.

This method also has the following side-effects:


Get_new_root_coords

protected CDasherModel.GNRCReturn Get_new_root_coords(long Mousex,
                                                      long Mousey)
Calculate the new co-ordinates for the root node after a single update step. For further information, see Doc/geometry.tex.

Parameters:
Mousex - x mouse co-ordinate measured right to left.
Mousey - y mouse co-ordinate measured top to bottom.
Returns:
New root co-ordinates.

Tap_on_display

public boolean Tap_on_display(long miMousex,
                              long miMousey,
                              long Time,
                              java.util.ArrayList<CSymbolProb> pAdded)
Performs a single update of the model based on a given mouse position and the time elpased since the last update took place.

If BP_OLD_STYLE_PUSH is enabled, prompts the creation of new segments of tree where appropriate, using OldPush. If not, we let node pushing take place elsewhere.

In the case that the m_deGotoQueue contains any points, indicating that a pre-scheduled zoom is currently in progress, we move to the next specified point in the queue instead and ignore the mouse position.

Internally, this method uses Get_new_root_coords to work out where to go, and NewGoto to actually go there.

If this method is called whilst Dasher is paused, it will do nothing and return false.

Parameters:
miMousex - Current mouse X co-ordinate
miMousey - Current mouse Y co-ordinate
Time - Current system time as a UNIX timestamp
pAdded - Ignored parameter
Returns:
True if we have updated the model, false otherwise.

OldPush

protected void OldPush(long iMousex,
                       long iMousey)
Expands sections of the node tree, using random point selection and the Get_node_under method to try to bias the process in favour of larger nodes.

Takes account of the current frame rate, and does more pushing if Dasher is performing better.

This method is only ever used if BP_OLD_STYLE_PUSH is enabled which is not the default.

The actual node pushing is done by Push_Node.

Parameters:
iMousex - Current mouse X co-ordinate
iMousey - Current mosue Y co-ordinate

RecursiveOutput

protected void RecursiveOutput(CDasherNode Node,
                               java.util.ArrayList<CSymbolProb> pAdded)
Given a Node which is supposed to be the current end of output, recursively checks whether the parent's Seen property is true (which indicates it has been output if appropriate) and invokes the AlphabetManager's Enter and Output methods on each unseen ancestor in tree-descending order.

The nodes' Seen flag is also set, preventing repeated output of the same nodes.

Parameters:
Node - Node to output, possibly including its ancestors
pAdded - ArrayList which will be filled with output characters for logging purposes.

NewGoTo

protected void NewGoTo(long newRootmin,
                       long newRootmax)
Changes the state of the Model updating the values of m_RootMax and m_RootMin, which has the effect of making us appear to move around. Also pushes the node we're moving into, and cues output handling.

Both values are checked for sanity and truncated if necessary.

m_iTargetMax and Min are also updated according to the new values of RootMax/Min.

For the purpose of output handling, the node under the crosshair is noted before and after enacting the move, and HandleOutput invoked upon this pair.

At present, this function takes no action if the proposed new values are not allowable; it returns without making any changes which has the effect of causing Dasher to freeze.

Parameters:
newRootmin - Desired new value of m_RootMin
newRootmax - Desired new value of m_RootMax

HandleOutput

protected void HandleOutput(CDasherNode NewNode,
                            CDasherNode OldNode)
Handles output based on the nodes which were under the crosshair before and after a move.

If the NewNode has its Seen flag already set, returns without taking any action.

Internally this works by calling DeleteCharacters on the two nodes if they are different, and then RecursiveOutput on the current node and null.

Parameters:
NewNode - Node now under the crosshair
OldNode - Node previously under the crosshair (maybe the same as NewNode)

DeleteCharacters

protected boolean DeleteCharacters(CDasherNode newnode,
                                   CDasherNode oldnode)
Traces back from oldnode to either a) newnode, in the case that oldnode is a descendent of newnode, or b) to the nearest common ancestor (ie. the nearest ancestor of newnode which has its seen flag set), calling the AlphabetManager's Undo method on each in turn.

In case a) we will now be consistent with the user's current location; in case b) we have deleted the text belonging to oldnode's branch but not output the text for newnode; HandleOutput must be used to finish the job.

If either parameter is null, this method will return false and take no action.

Parameters:
newnode - Node currently under the crosshair
oldnode - Node previously under the crosshair
Returns:
False if either argument as null, True otherwise.

GetProbs

public long[] GetProbs(CContextBase context,
                       int iNorm)
Requests node probabilities from the language model given a context and a normalization value (usually LP_NORMALIZATION).

Internally, this recalculates the norm value using getNonUniformNorm, and passes the context and this new norm onto m_LanguageModel.getProbs.

Once the probabilities are calculated, it runs them through adjustProbs before returning.

Parameters:
context - Language model context in which the probabilities are to be found.
iNorm - Normalization
Returns:
Array of probabilities, in alphabet order.

adjustProbs

public void adjustProbs(long[] probs)
Increments all probabilities by the value of uniformAdd, and sets the final probability to ControlSpace.

Parameters:
probs - The probabilities to modify

getNonUniformNorm

public int getNonUniformNorm(int iNorm)
Calculates the non-uniform norm.

Parameters:
iNorm - Normalization value, usually LP_NORMALIZATION
Returns:
Non-uniform norm

getUniformAdd

protected int getUniformAdd(int iNorm)
Calculates a value to add to all probabilities before use, preventing any zero values from being used and potentially resulting in missing nodes.

Parameters:
iNorm - Normalization value (usually LP_NORMALIZATION)
Returns:
Uniform value to add to all probabilities.

getControlSpace

protected long getControlSpace(int iNorm)
Gets the probability to associate with the control node

This will be either 5% of the norm value if control mode is enabled, or zero otherwise.

Parameters:
iNorm - Normalization value (usually LP_NORMALIZATION)
Returns:
Probability of control node.

LearnText

public void LearnText(CContextBase context,
                      java.lang.String TheText,
                      boolean IsMore)
Extends a given context with a given string of characters, whilst modifying the language model itself based on what is entered.

The bulk of the work is deferred to the language model's LearnSymbol method.

Parameters:
context - Context to extend
TheText - Text to add
IsMore - Ignored

EnterText

public void EnterText(CContextBase context,
                      java.lang.String TheText)
Extends a given language model context without modifying the model itself.

The bulk of the work itself is deferred to the LanguageModel's EnterSymbol method.

Parameters:
context - Context to extend
TheText - Text to add

GetTrainer

public CDasherModel.CTrainer GetTrainer()
Gets this model's helper training class.

Returns:
Trainer class

Push_Node

protected void Push_Node(CDasherNode Node)
Deletes and then repopulates the children of a given node.

If the pushed node has no associated context, an attempt is made to derive it by extending that of the node's parent, and as a last ditch, creating an empty one.

Parameters:
Node - Node to push. Must not be null.

Recursive_Push_Node

protected void Recursive_Push_Node(CDasherNode Node,
                                   int iDepth)
Pushes a given node and recursively pushes its children to a given depth.

The tree of recursive pushes will be truncated whenever an attempt is made to push a node filling less than 10% of the screen or which is the control node.

Parameters:
Node - Node at which to start pushing
iDepth - Maximum depth to which we should push

RenderToView

public boolean RenderToView(CDasherView View,
                            boolean bRedrawDisplay)
Calls the View's Render method on our current Root; the View will take care of all drawing from here on in.

If BP_OLD_STYLE_PUSH is not enabled, all Nodes which the View reports it has drawn will be pushed here, and all which the View reported as undrawable due to being too small, off the screen, etc, will have their children deleted.

Parameters:
View - View to which we wish to draw
bRedrawDisplay - Whether to force a complete redraw
Returns:
True if the View changed anything, false otherwise

CheckForNewRoot

public boolean CheckForNewRoot(CDasherView View)
If the view reports that our current root node isn't visible, calls Reparent_root; if only one child of the current root is Alive (ie. on screen and visible), makes this child the root.

The actual work will be done by Reparent_root and Make_root respectively; this just decides which to use and when.

Parameters:
View - View against which to check node visibility.
Returns:
True if Reparent_root made any changes, false otherwise.

CorrectionFactor

protected double CorrectionFactor(long dasherx,
                                  long dashery)
TODO work out what this does and document.

Parameters:
dasherx - Dasher X co-ordinate
dashery - Dasher Y co-ordinate
Returns:
Correction factor

ScheduleZoom

public void ScheduleZoom(long dasherx,
                         long dashery)
Interpolates between our current position and a given new position, scheduling a zoom to the new position by adding the interpolated points to m_deGotoQueue.

dasherx will be increased to 100 if this is not already so.

The number of points to interpolate (and hence the smoothness of the zoom, at the expense of speed,) is controlled by LP_ZOOMSTEPS.

Parameters:
dasherx - Destination Dasher X co-ordinate
dashery - Destination Dasher Y co-ordinate

deleteLM

public void deleteLM()
Runs the LanguageModel's UnregisterComponent method, if there is currently a LanguageModel.


UnregisterComponent

public void UnregisterComponent()
Unregisters the language model and then ourselves.

Overrides:
UnregisterComponent in class CDasherComponent

Offset

public void Offset(int iOffset)
Sets each of Rootmin and Rootmax to TargetMin and TargetMax plus a given offset.

Parameters:
iOffset - Offset to add

MatchTarget

protected void MatchTarget()
Sets each of RootMin and RootMax to match their TargetMax and TargetMin partners.


NewFrame

public void NewFrame(long Time)
Deferred to m_fr.


Framerate

public double Framerate()
Deferred to m_fr.


Reset_framerate

public void Reset_framerate(long Time)
Deferred to m_fr.


Halt

public void Halt()
Deferred to m_fr.Initialise().


SetBitrate

public void SetBitrate(double TargetRate)
Deferred to m_fr.


ResetNats

public void ResetNats()
Sets total_nats back to 0.


GetNats

public double GetNats()
Gets total_nats

Returns:
total_nats

GetSpaceSymbol

public int GetSpaceSymbol()
Gets our current alphabet's Space symbol

Returns:
Requested symbol number

GetControlSymbol

public int GetControlSymbol()
Gets our current alphabet's Control symbol

Returns:
Requested symbol number

GetStartConversionSymbol

public int GetStartConversionSymbol()
Gets our current alphabet's Start-conversion symbol

Returns:
Requested symbol number

GetDisplayText

public java.lang.String GetDisplayText(int iSymbol)
Deferred to m_cAlphabet


GetAlphabet

public CAlphabet GetAlphabet()
Retrieves our current alphabet.


GetAlphabetNew

public CAlphabet GetAlphabetNew()
Retrieves our current alphabet.


GetRoot

public CDasherNode GetRoot(int iType,
                           CDasherNode Parent,
                           long iLower,
                           long iUpper,
                           int UserData)
Constructs a new root Node of a given type, with a given parent which may be null if necessary.

Parameters:
iType - Type of node to create. At present, ignored; only ordinary letter nodes are created.
Parent - Parent of the node we will create. May be null.
iLower - Desired Lbnd of the new Node
iUpper - Desired Hbnd of the new Node
Returns:
Newly created DasherNode

RegisterNode

public void RegisterNode(int iID,
                         java.lang.String strLabel,
                         int iColour)
Stub; implement if Control Mode is required.

The code for this is commented but present in the source.


ConnectNode

public void ConnectNode(int iChild,
                        int iParent,
                        int iAfter)
Stub; implement if Control Mode is required.

The code for this is commented but present in the source.


DisconnectNode

public void DisconnectNode(int iChild,
                           int iParent)
Stub; implement if Control Mode is required.

The code for this is commented but present in the source.


ScheduledSteps

public int ScheduledSteps()
Retrieves the number of points currently in the m_deGotoQueue.

Returns:
Number of scheduled steps.

CreateEmptyContext

protected CContextBase CreateEmptyContext()
Deferred to m_LanguageModel


GetColour

public int GetColour(int s)
Deferred to m_cAlphabet


GetColours

public java.util.ArrayList<java.lang.Integer> GetColours()
Deferred to m_cAlphabet