nrc.fuzzy
Class FuzzySet.UITools

java.lang.Object
  |
  +--nrc.fuzzy.FuzzySet.UITools
Enclosing class:
FuzzySet

protected class FuzzySet.UITools
extends java.lang.Object

The UITools class was created to support the Fuzzy Union, Intersection and Sum methods. The method fuzzyIntersectionUnion, the only method that truly does any union/intersection type calculations, requires that certain information be stored about each FuzzySet. Each UITools object is relevant only to the FuzzySet that contains it.

For example, the fuzzyIntersectionUnion algorithm works with the concept of comparing line segments; therefore, it is important to store two points for each FuzzySet to define the current line segment for that FuzzySet.

As shown above, the two points stored to define the current line segment are the UITools variables previous and current. The previous point always has a smaller x value than the current point.

Because each line segment of the FuzzySet is considered in sequence, it is also important to store the index of the current point in the FuzzySet; in this manner, the UITools object can keep track of where it is in the FuzzySet and can advance to the next line segment.

The UITools object also contains methods that have relevance only in terms of the fuzzyIntersectionUnion method. For example, testing whether the end of the FuzzySet has been reached, calculating the slope of the current line segment (showed in the above diagram), finding the intersection point of two line segments, and other such methods.

Basically, the UITools class bundles together all the essential variables and methods for the purpose of Intersection and Union that do not belong as a direct part of the FuzzySet.


Field Summary
protected  nrc.fuzzy.SetPoint current
          One of the two points required to define the current line segment being analyzed.
protected  int index
          The index of the current point in the FuzzySet to which this UITools object belongs.
protected  double maxX
          The maximum x value of any point in either this FuzzySet, or the other FuzzySet in question.
protected  nrc.fuzzy.SetPoint previous
          One of the two points required to define the current line segment being analyzed.
 
Constructor Summary
protected FuzzySet.UITools()
          Constructs a new UITools object.
 
Method Summary
protected  void addFinalPoint(FuzzySet.UITools b, nrc.fuzzy.FuzzySet fuzzySet, int operation)
          Adds the final point to the Union, Intersection or Sum set.
protected  void calculateSlope()
          Caluculates the slope of the line defined by previous, the previous point, and current, the current point.
protected  boolean endOfSet()
          Returns true if the end of the FuzzySet has been reached.
protected  nrc.fuzzy.SetPoint handleType1(FuzzySet.UITools b, int operation)
          Returns the next point that is to be stored in the Intersection, Union or Sum set.
protected  nrc.fuzzy.SetPoint handleType2(FuzzySet.UITools b, int operation)
          Returns the next point to be stored in the Fuzzy Intersection, Union or Sum Set, or returns null if there is no point to be stored.
protected  nrc.fuzzy.SetPoint handleType3(FuzzySet.UITools b, int operation)
          Returns the next point to be stored in the Intersection, Union, or Sum Set.
protected  nrc.fuzzy.SetPoint handleType4(FuzzySet.UITools b, nrc.fuzzy.SetPoint intersect, int operation)
          Returns the next point to be stored in the Intersection, Union or Sum Set.
protected  nrc.fuzzy.SetPoint handleType5(FuzzySet.UITools b, int operation)
          Returns the next point to be stored in the Intersection or Union Set.
protected  nrc.fuzzy.SetPoint handleType6(FuzzySet.UITools b, int operation)
          Returns the next point to be stored in the Intersection, Union, or Sum Set, or returns null if there is no point to be stored.
protected  void initializeStartingPoint(nrc.fuzzy.SetPoint bFirstPoint, nrc.fuzzy.SetPoint bLastPoint)
          Initializes the previous point, the current point, the index to keep track of what point we're on in the FuzzySet, and maxX, the maximum x value in either of the FuzzySets in question.
protected  java.lang.Object lineSegmentIntersection(FuzzySet.UITools b)
          Tests to see if two line segments, represented by the previous and current points of this UITool, and the UITool argument, intersect.
protected  void moveAheadOnePoint()
          Assigns the value of current, the current point, to previous, the previous point, and assigns the value of the next point in the FuzzySet to current.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

previous

protected nrc.fuzzy.SetPoint previous
One of the two points required to define the current line segment being analyzed. This point will always have a smaller x value than the current point.


current

protected nrc.fuzzy.SetPoint current
One of the two points required to define the current line segment being analyzed. This point will always have a smaller x value than the current point.


maxX

protected double maxX
The maximum x value of any point in either this FuzzySet, or the other FuzzySet in question.


index

protected int index
The index of the current point in the FuzzySet to which this UITools object belongs.

Constructor Detail

FuzzySet.UITools

protected FuzzySet.UITools()
Constructs a new UITools object.

Method Detail

endOfSet

protected boolean endOfSet()
Returns true if the end of the FuzzySet has been reached.

Returns:
true if the last point of this FuzzySet has been reached

moveAheadOnePoint

protected void moveAheadOnePoint()
Assigns the value of current, the current point, to previous, the previous point, and assigns the value of the next point in the FuzzySet to current. In essence, this method moves the UITool onto the next line segment in the FuzzySet.


initializeStartingPoint

protected void initializeStartingPoint(nrc.fuzzy.SetPoint bFirstPoint,
                                       nrc.fuzzy.SetPoint bLastPoint)
Initializes the previous point, the current point, the index to keep track of what point we're on in the FuzzySet, and maxX, the maximum x value in either of the FuzzySets in question.

Parameters:
bFirstPoint - the first SetPoint in the other FuzzySet
bLastPoint - the last SetPoint in the other FuzzySet

calculateSlope

protected void calculateSlope()
Caluculates the slope of the line defined by previous, the previous point, and current, the current point.


lineSegmentIntersection

protected java.lang.Object lineSegmentIntersection(FuzzySet.UITools b)
Tests to see if two line segments, represented by the previous and current points of this UITool, and the UITool argument, intersect. If the line segments intersect, the point of intersection is returned. If the line segments do not intersect, a boolean value is returned to indicate whether the line segments are collinear, or simply do not intersect.

Parameters:
b - the UITools object which provides the other line segment (previous and current point) to test against the line segment represented by this previous and current point
Returns:
a SetPoint object representing the intersection point, if the line segments intersect. If the line segments do not intersect, a Boolean object with a value of true is returned if the lines are collinear, and a Boolean object with a value of false is returned if the lines simply do not intersect.

handleType1

protected nrc.fuzzy.SetPoint handleType1(FuzzySet.UITools b,
                                         int operation)
Returns the next point that is to be stored in the Intersection, Union or Sum set. The conditions which must be affirmed before calling this method are as follows:

For a visual depiction of this situation, see the graph below.

Parameters:
b - the other UITools object through which to access any necessary information such as previous and current points
operation - the integer specifying the operation being performed. The values possible for this parameter are the constants UNION, INTERSECTION, SUM and MAXMIN. In all of the UITools handlers, INTERSECTION and MAXMIN are treated in the same manner.
Returns:
the SetPoint that is the next point to be stored in the Union or Intersection set

handleType2

protected nrc.fuzzy.SetPoint handleType2(FuzzySet.UITools b,
                                         int operation)
Returns the next point to be stored in the Fuzzy Intersection, Union or Sum Set, or returns null if there is no point to be stored. The condition which must be affirmed before calling this method is as follows:

For a visual depiction of this situation, see the graph below.

Parameters:
b - the other UITools object through which to access any necessary information such as previous and current points
operation - the integer specifying the operation being performed. The values possible for this parameter are the constants UNION, INTERSECTION, SUM and MAXMIN. In all of the UITools handlers, INTERSECTION and MAXMIN are treated in the same manner.
Returns:
the SetPoint that is the next point to be stored in the Union, Intersection or Sum set, or null if no such point exists and the handler simply advanced the UITools to the next line segment(s)

handleType3

protected nrc.fuzzy.SetPoint handleType3(FuzzySet.UITools b,
                                         int operation)
Returns the next point to be stored in the Intersection, Union, or Sum Set. The conditions which must be affirmed before calling this method are as follows:

For a visual depiction of this situation, see the graph below.

Parameters:
b - the other UITools object through which to access any necessary information such as previous and current points
operation - the integer specifying the operation being performed. The values possible for this parameter are the constants UNION, INTERSECTION, SUM and MAXMIN. In all of the UITools handlers, INTERSECTION and MAXMIN are treated in the same manner.
Returns:
the SetPoint that is the next point to be stored in the Union, Intersection or Sum set

handleType4

protected nrc.fuzzy.SetPoint handleType4(FuzzySet.UITools b,
                                         nrc.fuzzy.SetPoint intersect,
                                         int operation)
Returns the next point to be stored in the Intersection, Union or Sum Set. The conditions which must be affirmed before calling this method are as follows:

For a visual depiction of this situation, see the graph below.

Parameters:
b - the other UITools object through which to access any necessary information such as previous and current points
intersect - the SetPoint representing the intersection point of the two line segments
operation - the integer specifying the operation being performed. The values possible for this parameter are the constants UNION, INTERSECTION, SUM and MAXMIN. In all of the UITools handlers, INTERSECTION and MAXMIN are treated in the same manner.
Returns:
the SetPoint that is the next point to be stored in the Union or Intersection set

handleType5

protected nrc.fuzzy.SetPoint handleType5(FuzzySet.UITools b,
                                         int operation)
Returns the next point to be stored in the Intersection or Union Set. The conditions which must be affirmed before calling this method are as follows:

For a visual depiction of this situation, see the 1st situation in the graph below.

Parameters:
b - the other UITools object through which to access any necessary information such as previous and current points
operation - the integer specifying the operation being performed. The values possible for this parameter are the constants UNION, INTERSECTION, SUM and MAXMIN. In all of the UITools handlers, INTERSECTION and MAXMIN are treated in the same manner.
Returns:
the SetPoint that is the next point to be stored in the Union or Intersection set

handleType6

protected nrc.fuzzy.SetPoint handleType6(FuzzySet.UITools b,
                                         int operation)
Returns the next point to be stored in the Intersection, Union, or Sum Set, or returns null if there is no point to be stored. Note that the third stipulation for the calling of this method is that that the x value of the current point of this UITools is less than the x value of the current point of the UITools argument. Therefore, the manner in which this is called, ie. either a.handleType6(b) or b.handleType6(a), is the result of a test in the fuzzyIntersectionUnion method.

The conditions which must be affirmed before calling this method is as follows:

For a visual depiction of this situation, see the graph below.

Parameters:
b - the other UITools object through which to access any necessary information such as previous and current points
operation - the integer specifying the operation being performed. The values possible for this parameter are the constants UNION, INTERSECTION, SUM and MAXMIN. In all of the UITools handlers, INTERSECTION and MAXMIN are treated in the same manner.
Returns:
the SetPoint that is the next point to be stored in the Union or Intersection set, or null if no such point exists and the handler simply advanced the UITools to the next line segment(s)

addFinalPoint

protected void addFinalPoint(FuzzySet.UITools b,
                             nrc.fuzzy.FuzzySet fuzzySet,
                             int operation)
Adds the final point to the Union, Intersection or Sum set.

Parameters:
b - the other UITools object through which to access any necessary information such as previous and current points
fuzzySet - the FuzzySet that the final point is to be added to. This is either a Union set or an Intersection set; the method determines which from the operation parameter.
operation - the integer specifying the operation being performed. The values possible for this parameter are the constants UNION and INTERSECTION.