infosapient.system
Class FzyAttribute

java.lang.Object
  |
  +--infosapient.system.ObservableImpl
        |
        +--infosapient.system.FzySystemComponent
              |
              +--infosapient.system.FzyClauseComponent
                    |
                    +--infosapient.system.FzyAttribute
Direct Known Subclasses:
FzyBooleanAttribute

public class FzyAttribute
extends FzyClauseComponent
implements Observer, XMLOutput, java.io.Serializable, java.lang.Cloneable

Class FzyAttribute represents the 'Universe of Discourse' for a fuzzy space. I.e. it represents the translation of contigous crisp values into symbolic values such as 'high', 'light', etc. for a given attribute. An attribute is any given property or quality for an entity.

Examples of an attribute would be

Version:
$Revision: 1.1.1.1 $ Added two new attributes and getter/setters to the class, description and prompt. Shannon Roubal 12/15/1999 11:10 AM Added a new construct to include the description and prompt values. Shannon Roubal 12/15/1999 11:10 AM
See Also:
Serialized Form

Inner Class Summary
(package private)  class FzyAttribute.MembershipGreaterThan
           
 
Field Summary
private  java.lang.String attributeDescription
           
private  java.lang.String attributeName
           
private  java.lang.String attributePrompt
           
private  double currDomainValue
           
private  double initialValue
           
(package private) static long serialVersionUID
           
private  java.util.Vector sets
           
private  FzySolutionSet solutionSet
           
private  boolean solutionSetCreated
           
private  FzyKnowledgebase theKB
           
 
Fields inherited from class infosapient.system.FzyClauseComponent
owner, text
 
Fields inherited from class infosapient.system.FzySystemComponent
DEBUG_, myID, name, pcs, serialVersionUID, trace, vcs
 
Fields inherited from class infosapient.system.ObservableImpl
arr, changed, obs, serialVersionUID
 
Constructor Summary
FzyAttribute(FzyKnowledgebase kb)
           
FzyAttribute(java.lang.String attribName, FzyKnowledgebase kb)
           
FzyAttribute(java.lang.String attribName, java.lang.String attribDesc, java.lang.String attribPrompt, FzyKnowledgebase kb)
          Create a new attribute with name, description, prompt, and knowledgebase.
 
Method Summary
 boolean addSet(FzySet aSet)
          Add a unique FzySet to this FzyAttribute.
 boolean addSet(FzySet aSet, int index)
          Add a set at a specific index.
 void ask()
          Used by the rules engine to find out what the current solution is by asking the user.
 java.lang.Object clone()
          Provides a deep copy of this attribute, including a copy of its set collection, goal set or attribute, currentDomainValue and solutionSet.
 boolean containsSet(FzySet aSet)
          returns a boolean if this attribute contains the given FzySet.
 boolean containsSetNamed(java.lang.String aName)
          returns a boolean if this attribute contains the given FzySet name.
 com.objectspace.jgl.Array containsValue(double value)
          Checks whether a given value is within this domain and returns an array of FzySets
 double getCurrentDomainValue()
          Return the current domain value of this attribute.
 java.lang.String getDescription()
          Get the description for this attribute.
 double getDOMForCollection(double value)
          Returns the highest membership within the domain of all fuzzy sets within this attribute.
 double getInitialValue()
          Get this attribute's initial value.
 FzyKnowledgebase getKB()
          Return the Knowledgebase that this attribute belongs to.
 java.lang.String getPrompt()
          Get the prompt for this attribute.
 FzySet getSetNamed(java.lang.String aName)
          returns a FzySet given its name.
 java.lang.String[] getSetNames()
          Return an array containing the set names in sequence.
 double getSolution()
           
 double getSolutionDOM()
           
 FzySolutionSet getSolutionSet()
          Return the solution set for this attribute.
 boolean hasSolution()
           
 void printOn(java.io.Writer outWriter, int nTabs)
          Used to represent this attribute with its sets when saving knowledgebase
 void removeAllSets()
          Remove all sets within this Attribute.
 int removeFSet(FzySet rSet)
          Remove a fuzzy set and return the index that the set was found at.
 void reset()
          Resets the current domain value to Double.NaN
 void setChanged()
          Required for FzyAttribute inner class support.
 void setCurrentDomainValue(double value)
          Set the current domain value of this attribute.
 void setDescription(java.lang.String aDesc)
          Set the description for this attribute.
 void setInitialValue(double newInitialValue)
          Set the initial value of this attribute.
 void setPrompt(java.lang.String aPrompt)
          Set the prompt for this attribute.
 java.util.Vector sets()
          Return the set collection as a java.util.Vector
 void setSolution(double d)
           
 java.lang.String toString()
          String value of this object.
 java.lang.StringBuffer toXML(int nTabs)
          Represent this attribute as xml tags.
 void update(Observable obser, java.lang.Object obj)
          Used by the objects that I am observing to let me know that their state has changed.
 
Methods inherited from class infosapient.system.FzyClauseComponent
append, append, getOwner, getText, setOwnerClause, setText, toText
 
Methods inherited from class infosapient.system.FzySystemComponent
addPropertyChangeListener, addVetoableChangeListener, equals, getID, getName, getPropertyChangeSupport, getVetoableChangeSupport, hashCode, removePropertyChangeListener, removeVetoableChangeListener, setID, setName
 
Methods inherited from class infosapient.system.ObservableImpl
addObserver, clearChanged, containsObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID

solutionSetCreated

private boolean solutionSetCreated

sets

private java.util.Vector sets

currDomainValue

private double currDomainValue

initialValue

private double initialValue

attributeName

private java.lang.String attributeName

attributeDescription

private java.lang.String attributeDescription

attributePrompt

private java.lang.String attributePrompt

theKB

private FzyKnowledgebase theKB

solutionSet

private FzySolutionSet solutionSet
Constructor Detail

FzyAttribute

public FzyAttribute(FzyKnowledgebase kb)
             throws java.lang.IllegalArgumentException

FzyAttribute

public FzyAttribute(java.lang.String attribName,
                    FzyKnowledgebase kb)
             throws java.lang.IllegalArgumentException

FzyAttribute

public FzyAttribute(java.lang.String attribName,
                    java.lang.String attribDesc,
                    java.lang.String attribPrompt,
                    FzyKnowledgebase kb)
             throws java.lang.IllegalArgumentException
Create a new attribute with name, description, prompt, and knowledgebase.
Parameters:
String - - the proposed attribute name (MAY NOT be null).
String - - the description of this attribute.
String - - the prompt for the attribute.
FzyKnowledgebase - - the kb that this attribute will be added to (cannot be null).
Method Detail

addSet

public boolean addSet(FzySet aSet)
               throws java.lang.IllegalArgumentException
Add a unique FzySet to this FzyAttribute.
Parameters:
FzySet - the set to be added to the attribute.
Returns:
boolean true if the set was added.

addSet

public boolean addSet(FzySet aSet,
                      int index)
Add a set at a specific index.
Parameters:
FzySet - the set to be added.
int - the index that the set is to be placed at.
Returns:
boolean true if the set was added.

ask

public void ask()
Used by the rules engine to find out what the current solution is by asking the user.
See Also:
FzyTorquemada.solveGoal(infosapient.system.FzyAttribClause), FzyEngineController#handleAskPrompt

clone

public java.lang.Object clone()
Provides a deep copy of this attribute, including a copy of its set collection, goal set or attribute, currentDomainValue and solutionSet.
Overrides:
clone in class java.lang.Object
Returns:
Object a copy of this attribute

containsSet

public boolean containsSet(FzySet aSet)
                    throws java.lang.IllegalArgumentException
returns a boolean if this attribute contains the given FzySet.
Parameters:
FzySet - -- the set to be found within this FzyAttribute.
Returns:
boolean -- true if found.

containsSetNamed

public boolean containsSetNamed(java.lang.String aName)
                         throws java.lang.IllegalArgumentException
returns a boolean if this attribute contains the given FzySet name.
Parameters:
String - name -- the set to be found within this FzyAttribute.
Returns:
boolean -- true if found.

containsValue

public com.objectspace.jgl.Array containsValue(double value)
Checks whether a given value is within this domain and returns an array of FzySets
Parameters:
double - the value to be compared
Returns:
FzySet[] of all sets that this value is contained.

getCurrentDomainValue

public double getCurrentDomainValue()
Return the current domain value of this attribute.
Returns:
double the current domain value of this fuzzy set.

getDescription

public java.lang.String getDescription()
Get the description for this attribute.
Returns:
String this.description

getDOMForCollection

public double getDOMForCollection(double value)
                           throws java.lang.IllegalArgumentException
Returns the highest membership within the domain of all fuzzy sets within this attribute.
Parameters:
double - the value within this domain

getInitialValue

public double getInitialValue()
Get this attribute's initial value. Creation date: (2/8/00 11:31:13 AM)
Returns:
double

getKB

public FzyKnowledgebase getKB()
Return the Knowledgebase that this attribute belongs to.
Returns:
FzyKnowledgebase -- the owning knowledgebase.

getPrompt

public java.lang.String getPrompt()
Get the prompt for this attribute.
Returns:
String this.prompt

getSetNamed

public FzySet getSetNamed(java.lang.String aName)
                   throws java.lang.IllegalArgumentException
returns a FzySet given its name.
Parameters:
String - name -- the set to be found within this FzyAttribute.
Returns:
FzySet -- if found; else null.

getSetNames

public java.lang.String[] getSetNames()
Return an array containing the set names in sequence. Creation date: (1/1/00 3:48:02 PM)
Returns:
java.lang.String[]

getSolution

public double getSolution()

getSolutionDOM

public double getSolutionDOM()
Overrides:
getSolutionDOM in class FzyClauseComponent

getSolutionSet

public FzySolutionSet getSolutionSet()
Return the solution set for this attribute. Lazy instantiate if it does not exist. Set the name of the solution set to be the attrib name.
Returns:
FzySolutionSet.

hasSolution

public boolean hasSolution()
Overrides:
hasSolution in class FzyClauseComponent

printOn

public void printOn(java.io.Writer outWriter,
                    int nTabs)
             throws java.io.IOException
Used to represent this attribute with its sets when saving knowledgebase
Overrides:
printOn in class FzySystemComponent
Parameters:
java.io.Writer - - the outputWriter to use
int - - number of tabs to space over for this attribute.

removeAllSets

public void removeAllSets()
Remove all sets within this Attribute. Typically only used just before deleting the attribute.

removeFSet

public int removeFSet(FzySet rSet)
               throws java.lang.IllegalArgumentException
Remove a fuzzy set and return the index that the set was found at. This return value can be used to insert a new set at the same index. If -1, indicates that the set was not found within this attribute.
Parameters:
FzySet - The FzySet to be removed.

reset

public void reset()
Resets the current domain value to Double.NaN
Overrides:
reset in class FzyClauseComponent

setChanged

public void setChanged()
Required for FzyAttribute inner class support.
Overrides:
setChanged in class ObservableImpl

setCurrentDomainValue

public void setCurrentDomainValue(double value)
Set the current domain value of this attribute.
Parameters:
double - the current domain.
Returns:
FzyAttribute this attribute.

setDescription

public void setDescription(java.lang.String aDesc)
Set the description for this attribute.
Parameters:
String - the description
Returns:
FzyAttribute this attribute.

setInitialValue

public void setInitialValue(double newInitialValue)
Set the initial value of this attribute. Creation date: (2/8/00 11:31:13 AM)
Parameters:
newInitialValue - double

setPrompt

public void setPrompt(java.lang.String aPrompt)
Set the prompt for this attribute.
Parameters:
String - the prompt
Returns:
FzyAttribute this attribute.

sets

public java.util.Vector sets()
Return the set collection as a java.util.Vector
Returns:
java.util.Vector sets -- the fuzzy set orderedCollection.

setSolution

public void setSolution(double d)

toString

public java.lang.String toString()
String value of this object. Returns the Name of this FzyAttribute.
Overrides:
toString in class java.lang.Object

toXML

public java.lang.StringBuffer toXML(int nTabs)
Represent this attribute as xml tags. Creation date: (1/30/00 9:06:33 PM)
Specified by:
toXML in interface XMLOutput
Returns:
java.lang.StringBuffer

update

public void update(Observable obser,
                   java.lang.Object obj)
Used by the objects that I am observing to let me know that their state has changed.
Specified by:
update in interface Observer

License to use this program is provided under the TERMS OF THE COMMON PUBLIC LICENSE 0.5. ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.

Copyright (c) 2001, Workplace Performance Tools, All Rights Reserved