pilot
Class Situations

java.lang.Object
  |
  +--pilot.Situations
All Implemented Interfaces:
StatesAndSituations

public class Situations
extends java.lang.Object
implements StatesAndSituations


Field Summary
protected  java.util.Vector constraints_
          The contraints define the begin and end values of the controls for a situation.
protected  int currentIndex_
          Because of the sliding window of situations, this property is needed to pinpoint the index of the current situation.
protected  java.util.Vector names_
          This vector contains the names of the situations.
protected  java.util.Vector[] situationValues_
          This array of vectors maintains the values of the situation certainties.
protected  java.util.Vector tempSituation_
          This method is accessed by Jess to set the current situation.
protected  int windowSize_
          The window size determines the number of past situations that are maintained.
 
Constructor Summary
Situations()
          This constructor sets the default window size and initiates the properties of this class.
Situations(int ws)
          This constructor sets a specific window size and initiates the properties of this class.
 
Method Summary
 void addConstaints(java.util.Vector constraints)
           
 void addName(java.lang.String name)
          The method addName adds a new situation to the list of situation names.
 void addSituationValues(java.util.Vector situation)
          The method addSituationValue appends a situation vector to the window of situations.
 void addValueToTempSituation(java.lang.String name, java.lang.String value)
          The method addValueToTempSituation sets a value in the temporary Situation vector.
 java.lang.String constructRule(java.lang.String name, java.lang.String constraint, java.lang.String type)
          The method constructRule creates a defrule for Jess.
 java.util.Vector getConstraints()
          The method getConstraints returns all the contraints of all the situations.
 int getCurrentIndex()
          The method getCurrentIndex returns the index of the current situation.
 int getNameIndex(java.lang.String name)
          The method getNameIndex returns the index of a situation.
 java.util.Vector getNames()
          The method getNames returns a vector with the situation names.
 java.util.Vector[] getSituationValues()
          This method getSituationValues returns the complete array of situation vectors.
 java.util.Vector getSituationValues(int index)
          This method getSituationValues returns a specific situation in the array of situations.
 java.util.Vector getTempSituation()
          The method getTempSituation returns the temporary Situation vector.
 int getWindowSize()
          The method getWindowSize returns the value of the window size of this class.
 java.lang.String[] parseBeginEndString(java.util.Vector constraints)
          The method parseBeginEndString parses the constraints to a string in Jess format.
 java.util.Vector parseConstraintRules()
          The method parseConstraintRules parses all the constraints to rules in Jess format
 void resetTempSituation()
          The method resetTempSituation resets the temporary Situation vector.
 void setConstraints(java.util.Vector constraints)
          The method setConstraints sets the begin and end constraints of all the situations.
 void setCurrentIndex(int index)
          The method setCurrentIndex sets the index that determines the current situation.
 void setNames(java.util.Vector names)
          The method setNames sets the vector of situation names.
 void setSituationValues(int index, java.util.Vector situation)
          This method setSituationsValues sets one situation vector in the array of situations.
 void setSituationValues(java.util.Vector[] situations)
          This method setSituationValues sets the complete array of situation vectors.
 void setTempSituation(java.util.Vector temp)
          The method setTempSituation sets the temporary Situation vector.
 void setWindowSize(int ws)
          The method setWindowSize sets the value of the property windowSize_.
 int size()
          The method size returns the number of situations that are maintained by an object of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

windowSize_

protected int windowSize_
The window size determines the number of past situations that are maintained.

names_

protected java.util.Vector names_
This vector contains the names of the situations.

situationValues_

protected java.util.Vector[] situationValues_
This array of vectors maintains the values of the situation certainties. Each vector contains the certainty values for each situation so fuzzy reasoning is possible.

constraints_

protected java.util.Vector constraints_
The contraints define the begin and end values of the controls for a situation.

currentIndex_

protected int currentIndex_
Because of the sliding window of situations, this property is needed to pinpoint the index of the current situation.

tempSituation_

protected java.util.Vector tempSituation_
This method is accessed by Jess to set the current situation.
Constructor Detail

Situations

public Situations()
This constructor sets the default window size and initiates the properties of this class.

Situations

public Situations(int ws)
This constructor sets a specific window size and initiates the properties of this class.
Parameters:
ws - The value of the desired window size
Method Detail

setWindowSize

public void setWindowSize(int ws)
The method setWindowSize sets the value of the property windowSize_.
Specified by:
setWindowSize in interface StatesAndSituations
Parameters:
ws - The value of the desired window size

getWindowSize

public int getWindowSize()
The method getWindowSize returns the value of the window size of this class.
Specified by:
getWindowSize in interface StatesAndSituations
Returns:
The value of the window size.

setNames

public void setNames(java.util.Vector names)
The method setNames sets the vector of situation names.
Specified by:
setNames in interface StatesAndSituations
Parameters:
names - The vector with situation names.

getNames

public java.util.Vector getNames()
The method getNames returns a vector with the situation names.
Specified by:
getNames in interface StatesAndSituations
Returns:
The vector with the situation names.

addName

public void addName(java.lang.String name)
The method addName adds a new situation to the list of situation names.
Specified by:
addName in interface StatesAndSituations
Parameters:
name - The name of the situation

setSituationValues

public void setSituationValues(java.util.Vector[] situations)
This method setSituationValues sets the complete array of situation vectors.
Parameters:
situations - The array of values for the situation vectors.

setSituationValues

public void setSituationValues(int index,
                               java.util.Vector situation)
This method setSituationsValues sets one situation vector in the array of situations.
Parameters:
index - The index of the situation.
situations - The situations vector.

getSituationValues

public java.util.Vector[] getSituationValues()
This method getSituationValues returns the complete array of situation vectors.
Returns:
The array of situation vectors.

getSituationValues

public java.util.Vector getSituationValues(int index)
This method getSituationValues returns a specific situation in the array of situations.
Parameters:
index - The index value of the requested situation.
Returns:
The requested situation vector.

addSituationValues

public void addSituationValues(java.util.Vector situation)
The method addSituationValue appends a situation vector to the window of situations.
Parameters:
situation - The situation vector.

setCurrentIndex

public void setCurrentIndex(int index)
The method setCurrentIndex sets the index that determines the current situation.
Parameters:
index - The index of the current situation.

getCurrentIndex

public int getCurrentIndex()
The method getCurrentIndex returns the index of the current situation.
Returns:
The index of the current situation.

size

public int size()
The method size returns the number of situations that are maintained by an object of this class.
Specified by:
size in interface StatesAndSituations
Returns:
The number of situations maintained.

getNameIndex

public int getNameIndex(java.lang.String name)
The method getNameIndex returns the index of a situation.
Parameters:
name - The name of the situation.
Returns:
The index of the situation.

setTempSituation

public void setTempSituation(java.util.Vector temp)
The method setTempSituation sets the temporary Situation vector.
Parameters:
temp - The temporary situation vector

getTempSituation

public java.util.Vector getTempSituation()
The method getTempSituation returns the temporary Situation vector.
Returns:
The temporary situation vector

resetTempSituation

public void resetTempSituation()
The method resetTempSituation resets the temporary Situation vector.

addValueToTempSituation

public void addValueToTempSituation(java.lang.String name,
                                    java.lang.String value)
The method addValueToTempSituation sets a value in the temporary Situation vector.
Parameters:
name - The name of the situation.
value - The value of the situation.

setConstraints

public void setConstraints(java.util.Vector constraints)
The method setConstraints sets the begin and end constraints of all the situations.
Parameters:
constraints - The vector of all constraints.

getConstraints

public java.util.Vector getConstraints()
The method getConstraints returns all the contraints of all the situations.
Returns:
The vector of all constraints.

addConstaints

public void addConstaints(java.util.Vector constraints)

parseConstraintRules

public java.util.Vector parseConstraintRules()
The method parseConstraintRules parses all the constraints to rules in Jess format
Returns:
A vector with all the rules.

parseBeginEndString

public java.lang.String[] parseBeginEndString(java.util.Vector constraints)
The method parseBeginEndString parses the constraints to a string in Jess format.
Parameters:
constraints - A vector with constraints.
Returns:
Two strings, one for the start and one for the end rule.

constructRule

public java.lang.String constructRule(java.lang.String name,
                                      java.lang.String constraint,
                                      java.lang.String type)
The method constructRule creates a defrule for Jess.
Parameters:
name - The name of the situation.
constraint - A string defining the constraints.
type - The type is either start or end.
Returns:
The rule is Jess format.