next up previous contents
Next: DTWFileIO module detail Up: GUI detailed design Previous: Rough user interface layout   Contents

DTWData module detail

Private data and data structures
Vector Templates

A vector containing DTWTemplateListItem objects. Data can be added by using Vector.add( Object o ) -method. Removing data is done using Vector.remove(Object o) -method. Templates Vector is used to contain DTWTemplateListItem items for storing template locations in DLL data structures and template names.

DTWDataVector Observation

An object containing the current observation.

DTWParameters Parameters

An object containing parameters for DTW algorithm.

DTWOneResult[] Results

Algorithm run results.

int[][] WarpingPath

Warping path.

DTWDLLApi DLLApi

DLLApi object.

Implementation of methods
getTemplates

  1. Create a new array of DTWDataVector objects of size Templates.size(). If Templates.size() is zero, return a null reference.
  2. Loop and get templates from DLL using method DTWDLLApi.getTemplate(int tIndex).
  3. Store the templates to the new DTWDataVector array.
  4. Return the new DTWDataVector array.

getTemplateList

  1. Create a new array of DTWTemplateListItems of size Templates.size().
  2. Copy elements from Templates Vector elements to the new array.
  3. Return the new array of DTWTemplateListItems.

addTemplates
Loop following actions for newTemplates.length() times. Variable i is the looping counter.

  1. Create a new DTWTemplateListItem object.
  2. Set name for the new DTWTemplateListItem to newTemplates[i].getName().
  3. Call DTWDLLApi.addTemplate method with parameter newTemplates[i].getValues().
  4. Set tIndex for the new DTWTemplateListItem to the return value of DTWDLLApi.addTemplates method.
  5. Add DTWTemplateListItem to Templates Vector.

getTemplateName

  1. Loop through Templates Vector for a template with index tIndex.
  2. Return template name for the found DTWTemplateListItem.

deleteTemplate

  1. Call DLLApi method delTemplate with parameter tIndex.
  2. Loop through Templates Vector for a template with tIndex value matching tIndex.
  3. Call Templates.remove() method for the template matching with tIndex.

deleteAllTemplates
Repeat the following action for all the templates in Templates Vector.

  1. Loop through all items in Templates and call DLLApi method delTemplate(i).
  2. Call Templates.removeAllElements() method.

getObservation

  1. Return Observation object.

setObservation

  1. Set Observation to newObservation received as a parameter.

getObservationName

  1. Return Observation.getName().

setDTWParameters

  1. Copy DTW parameters from newParameters to Parameters.

getDTWParameters

  1. Create a new StringBuffer object.
  2. Append to the StringBuffer object ``DTW Algorithm parameters.''
  3. Append to the StringBuffer object ``Euclidian Metrics'' and endline, if Parameters.dmetrics = EuclidianDistanceMetrics.
  4. Append to the StringBuffer object ``Derivative Metrics'' and endline, if Parameters.dmetrics = DerivativeDistanceMetrics.
  5. Append to the StringBuffer object ``Warping window width: `` and Parameters.wwidth and endline.
  6. Append to the StringBuffer object ``Sconstraint: `` and Parameters.sconstraint and endline
  7. Append to the StringBuffer object ``Fixed start and end points'' and endline if Parameters.seoffset = 0.
  8. Append to the StringBuffer object ``Allowable start and end point offset: `` and Parameters.seoffset and endline if Parameters.seoffset > 0.
  9. Return StringBuffer converted to String.

getWindowWidth

  1. Return Parameters.getWWidth().

DTWCompareAll

  1. Call DLLApi method CompareAll with parameters Observation.values, Parameters.
  2. Initialize Results with a new array of size Templates.size().
  3. Store the return value to Results.
  4. Call DTWCompareOne method with best matching template.

DTWCompareOne

  1. Call DLLApi method CompareOne with parameters Observation.values, Parameters, tIndex.
  2. Store the return values in Results and WarpingPath.

getResults

  1. Return Results array.

getWarpingPath

  1. Return WarpingPath.


next up previous contents
Next: DTWFileIO module detail Up: GUI detailed design Previous: Rough user interface layout   Contents
2002-03-19