// ******************************************************************
// *
// * LsAnswer.js
// *
// * Copyright (C) 1999 by LexiQuest SA, France. All rights reserved.
// *
// ******************************************************************/

//
// LsAnswerUserMatchWord class.
//
function _lsAnswerUserMatchWordInit(pUserMatch, pIndexQueryWord, pUserQueryWord)
{
  this.userMatch      = pUserMatch;
  this.indexQueryWord = pIndexQueryWord;
  this.userQueryWord  = pUserQueryWord;
}

function LsAnswerUserMatchWord(pUserMatch, pIndexQueryWord, pUserQueryWord)
{
  this.initialize = _lsAnswerUserMatchWordInit;

  this.initialize(pUserMatch, pIndexQueryWord, pUserQueryWord);
}


//
// LsAnswerMatchQuery class.
//
function _lsAnswerMatchQueryInit()
{
  this.text            = "";     // Type : string.
  this.globalScore     = 0;      // Type : integer between 0 and 1000.
  this.indexScore      = 0;      // Type : integer between 0 and 1000.
  this.userScore       = 0;      // Type : integer between 0 and 1000.
  this.distance        = 0;      // Type : positive integer.
  this.userMatchWords  = null;   // Type : array of LsAnswerUserMatchWord objects.
  this.indexMatchWords = null;   // Type : array of boolean values.
}

function LsAnswerMatchQuery()
{
  // "Public" methods.
  this.initialize = _lsAnswerMatchQueryInit;

  this.initialize();
}

//
// LsSearchExtraFeature class.
//

function _lsSearchExtraFeature()
{
  this.feature = "";
  this.value   = "";
  this.isString= 0;
}

function LsSearchExtraFeature()
{
  // "Public" methods.
  this.initialize = _lsSearchExtraFeature;

  this.initialize();
}


//
// LS_MATCHTYPE enumeration.
//
function _LS_MATCHTYPE()
{
  this.NO_MATCH    = 0;
  this.ROUGH_MATCH = 1;
  this.CLOSE_MATCH = 2;
  this.FULL_MATCH  = 3;
  this.EXACT_MATCH = 4;
}
// Dedicated constant, to simulate an "enum".
var LS_MATCHTYPE = new _LS_MATCHTYPE();

//
// LsAnswer class.
//

// Initialization of LsAnswer object.
function _lsAnswerInit()
{
  // "Public" properties.
  this.id                  = "";      // Type : string.
  this.path                = "";      // Type : string.
  this.code                = "";      // Type : string.
  this.type                = 0;       // Type : positive integer.
  this.text                = "";      // Type : string.
  this.url                 = "";      // Type : string.
  this.score               = 0.0;     // Type : float number between 0 and 1.
  this.globalScore         = 0;       // Type : integer between 0 and 1000.
  this.indexScore          = 0;       // Type : integer between 0 and 1000.
  this.userScore           = 0;       // Type : integer between 0 and 1000.
  this.distanceScore       = 0;       // Type : integer between 0 and 1000.
  this.postProcess	       = "";      // Type : string.
  this.matchQueryArray     = null;    // Type : array of LsAnswerMatchQuery objects.
  this.extraFeaturesArray  = null;    // Type : array of LsSearchExtraFeature objects.
  this.matchType           = LS_MATCHTYPE.NO_MATCH;
}

// LsAnswer Constructor.
function LsAnswer()
{
  // "Public" methods.
  this.initialize = _lsAnswerInit;

  this.initialize();
}


//
// LsClass class.
//

// Initialization of LsClass object.
function _lsClassInit()
{
  // "Public" properties.
  this.folderPath          = "";      // Type : string.
  this.folderCode          = "";      // Type : string.
  this.folderLabel         = "";      // Type : string.
  this.type                = 0;       // Type : positive integer.
  this.score               = 0.0;     // Type : float number between 0 and 1.
  this.globalScore         = 0;       // Type : integer between 0 and 1000.
  this.indexScore          = 0;       // Type : integer between 0 and 1000.
  this.userScore           = 0;       // Type : integer between 0 and 1000.
  this.distanceScore       = 0;       // Type : integer between 0 and 1000.
  this.postProcess	       = "";      // Type : string.
  this.classArray          = null;    // Type : array of LsClass (classes belonging to "this" class).
  this.answerIndexArray    = null;    // Type : array of int (indices in LsResult.answerArray array).
  this.matchType           = LS_MATCHTYPE.NO_MATCH;
}

// LsClass Constructor.
function LsClass()
{
  // "Public" methods.
  this.initialize = _lsClassInit;

  this.initialize();
}



//
// LsResult class.
//

// Initialization of LsResult object.
function _lsResultInit()
{
  // "Public" properties.
  this.initialQuery      = "";         // Type : string.
  this.sanitizedQuery    = "";         // Type : string.
  this.wordsInQuery      = null;       // Type : Array of string.
  this.queryAnalysis     = null;       // Type : LsQueryAnalysis object.
  this.answerArray       = null;       // Type : Array of LsAnswer objects.
  this.classArray        = null;       // Type : Array of LsClass objects.
  this.matchType         = LS_MATCHTYPE.NO_MATCH;
  this.score             = 0.0;        // Type : float (0 to 1). Populated only if all answers have the same score.
  this.totalAnswer	     = 0;
  this.totalAnswerClause = 0; 
}

// LsResult Constructor.
function LsResult()
{
    // "Public" methods.
  this.initialize = _lsResultInit;

  this.initialize();
}

