scheduler.modules
Class SchedulerCRNManager

java.lang.Object
  extended byscheduler.modules.SchedulerCRNManager
All Implemented Interfaces:
TravelSolutionsJudger

public final class SchedulerCRNManager
extends java.lang.Object
implements TravelSolutionsJudger

A class used to keep eye on user's history of travels (both accepted and rejected cases are stored). It also performs the finding out of similar cases from the past to the given one. It uses the CRN to achieve that all.

Author:
Piotrek

Field Summary
private  CRN crn
          A CRN used to store the history.
private  java.lang.String historyFileName
          A name of the history file.
 
Constructor Summary
SchedulerCRNManager(java.lang.String historyFileName)
          Constructor.
 
Method Summary
 void AddTravelSolution(ConnectionsFinderTask travelSolution, boolean fAccepted)
          Add the given travel solution to the history.
private  Case GetCase(ConnectionsFinderTask travelSolution, boolean fAccepted)
          Converts the travel solution to the CRN case.
 CRN GetCRN()
          Gets the CRN used by this CRN manager.
 double JudgeTravelSolution(ConnectionsFinderTask travelSolution)
          Judges the given travel solution.
 void SaveToFile()
          Saves the current history state to the file it has been loaded from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

historyFileName

private java.lang.String historyFileName
A name of the history file.


crn

private CRN crn
A CRN used to store the history.

Constructor Detail

SchedulerCRNManager

public SchedulerCRNManager(java.lang.String historyFileName)
Constructor.

Parameters:
historyFileName - A name of the file with the history to be loaded now and saved on exit.
Method Detail

GetCRN

public CRN GetCRN()
Gets the CRN used by this CRN manager.

Returns:
The requested CRN.

SaveToFile

public void SaveToFile()
Saves the current history state to the file it has been loaded from.


JudgeTravelSolution

public double JudgeTravelSolution(ConnectionsFinderTask travelSolution)
Description copied from interface: TravelSolutionsJudger
Judges the given travel solution.

Specified by:
JudgeTravelSolution in interface TravelSolutionsJudger
Parameters:
travelSolution - A travel solution to be judged.
Returns:
A similarity to the historical case. It is a value in range of [-1; 1], where -1 is 100% similarity to the rejected case and 1 is 100% similarity to the accepted case. Zero is returned if there is no historical data.
See Also:
TravelSolutionsJudger.JudgeTravelSolution(ConnectionsFinderTask)

AddTravelSolution

public void AddTravelSolution(ConnectionsFinderTask travelSolution,
                              boolean fAccepted)
Description copied from interface: TravelSolutionsJudger
Add the given travel solution to the history.

Specified by:
AddTravelSolution in interface TravelSolutionsJudger
Parameters:
travelSolution - A travel solution to be added.
fAccepted - Indicates whether this case has been accepted ot rejected by the user.
See Also:
TravelSolutionsJudger.AddTravelSolution(ConnectionsFinderTask, boolean)

GetCase

private Case GetCase(ConnectionsFinderTask travelSolution,
                     boolean fAccepted)
Converts the travel solution to the CRN case.

Parameters:
travelSolution - A travel solution to be converted.
fAccepted - Indicates whether the returned case must be the accepted or rejected.
Returns:
A CRN case being a result of convertion (it is an accpeted case).