|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nrc.fuzzy.Modifiers
This class maintains a list (in a hash table) of the fuzzy modifiers (or hedges) that are available to users. Modifiers manipulate a fuzzy value/fuzzy set returning a new fuzzy value/fuzzy set changed according to the modifier objectives. For example, the modifier 'very' squares each membership value in a fuzzy set.
Modifiers are also used in linguistic expressions when defining FuzzyValues.
For example we might create the FuzzyValue:
FuzzyValue fv = new FuzzyValue(tempFvar, "very hot");
Each individual fuzzy modifier is created as a subclass of the ModifierFunction class. If created according to the instructions provided these fuzzy modifer classes when Constructed will automatically call the Modifiers.add method to add themselves to the list of available modifiers. So the preferred way to add new modifiers is:
public class VeryModifier extends ModifierFunction
{
public VeryModifier() // use a default name for the modifier
{
// required to set the name of the modifier
// and add to list in Modifiers class
super( "very" );
}
public VeryModifier(String s) // use a supplied name for the modifier
{
// required to set the name of the modifier
// and add to list in Modifiers class
super( s );
}
public FuzzyValue call(FuzzyValue fv)
{
FuzzyValue fvNew = null;
// executes the 'call' method below for FuzzySet to do the modifier function
FuzzySet fs = call(fv.getFuzzySet());
try {
fvNew = new FuzzyValue(fv.getFuzzyVariable(), fs);
}
catch (XValueOutsideUODException e)
{ // we know that the modifers like 'very' do not expand the x value range
// of the fuzzy set so if get this exception there must be an internal error
System.err.println("Internal error in Modifier function '"+getName()+
"': " + e);
System.exit(100);
}
// must do this to set the linguistic expression for the new fuzzy value
fvNew.unaryModifyLinguisticExpression(getName(), fv.getLinguisticExpression());
return(fvNew);
}
public FuzzySet call(FuzzySet fs)
{ // the real work is done here -- on the fuzzy set
return(concentrateDilute(fs, 2.0));
}
}
myVeryMod = new VeryModifier("very");
...
aModifiedFuzzyValue = myVeryMod.call(aFuzzyValue);
OR
String mod = "very";
...
aModifiedFuzzyValue = Modifers.call(mod, aFuzzyValue);
The second form uses the Modifiers class to perform a 'variable' modifier method and
is used internally by the fuzzy package when creating fuzzy values or
fuzzy terms using 'linguistic expressions'.
aModifiedFuzzyValue = Modifers.very(aFuzzyValue);
NOTE: all modifier names are case insensitive ('very' is the same as 'VERY')
ModifierFunction
,
Serialized FormConstructor Summary | |
Modifiers()
|
Method Summary | |
static nrc.fuzzy.FuzzySet |
above(nrc.fuzzy.FuzzySet fs)
Execute the 'above' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
above(nrc.fuzzy.FuzzyValue fv)
Execute the 'above' modifier on a FuzzyValue |
static void |
add(nrc.fuzzy.ModifierFunction mf)
Adds a modifier function to the hashtable of modifiers. |
static nrc.fuzzy.FuzzySet |
below(nrc.fuzzy.FuzzySet fs)
Execute the 'below' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
below(nrc.fuzzy.FuzzyValue fv)
Execute the 'below' modifier on a FuzzyValue |
static nrc.fuzzy.FuzzySet |
call(java.lang.String modifierName,
nrc.fuzzy.FuzzySet fs)
Modify the FuzzySet specified using the ModifierFunction associated with the specified modifier name |
static nrc.fuzzy.FuzzyValue |
call(java.lang.String modifierName,
nrc.fuzzy.FuzzyValue fv)
Modify the FuzzyValue specified using the ModifierFunction associated with the specified modifier name |
static nrc.fuzzy.FuzzySet |
extremely(nrc.fuzzy.FuzzySet fs)
Execute the 'extremely' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
extremely(nrc.fuzzy.FuzzyValue fv)
Execute the 'extremely' modifier on a FuzzyValue |
static java.lang.String[] |
getModifierNames()
Retrieves the list of modifier names in an array. |
static nrc.fuzzy.FuzzySet |
intensify(nrc.fuzzy.FuzzySet fs)
Execute the 'intensify' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
intensify(nrc.fuzzy.FuzzyValue fv)
Execute the 'intensify' modifier on a FuzzyValue |
static boolean |
isModifier(java.lang.String modifierName)
Checks to see if the specified modifier exists. |
static nrc.fuzzy.FuzzySet |
more_or_less(nrc.fuzzy.FuzzySet fs)
Execute the 'more_or_less' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
more_or_less(nrc.fuzzy.FuzzyValue fv)
Execute the 'more_or_less' modifier on a FuzzyValue |
static nrc.fuzzy.FuzzySet |
norm(nrc.fuzzy.FuzzySet fs)
Execute the 'norm' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
norm(nrc.fuzzy.FuzzyValue fv)
Execute the 'norm' modifier on a FuzzyValue |
static nrc.fuzzy.FuzzySet |
not(nrc.fuzzy.FuzzySet fs)
Execute the 'not' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
not(nrc.fuzzy.FuzzyValue fv)
Execute the 'not' modifier on a FuzzyValue |
static nrc.fuzzy.FuzzySet |
plus(nrc.fuzzy.FuzzySet fs)
Execute the 'plus' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
plus(nrc.fuzzy.FuzzyValue fv)
Execute the 'plus' modifier on a FuzzyValue |
static nrc.fuzzy.FuzzySet |
slightly(nrc.fuzzy.FuzzySet fs)
Execute the 'slightly' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
slightly(nrc.fuzzy.FuzzyValue fv)
Execute the 'slightly' modifier on a FuzzyValue |
static nrc.fuzzy.FuzzySet |
somewhat(nrc.fuzzy.FuzzySet fs)
Execute the 'somewhat' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
somewhat(nrc.fuzzy.FuzzyValue fv)
Execute the 'somewhat' modifier on a FuzzyValue |
static nrc.fuzzy.FuzzySet |
very(nrc.fuzzy.FuzzySet fs)
Execute the 'very' modifier on a FuzzySet |
static nrc.fuzzy.FuzzyValue |
very(nrc.fuzzy.FuzzyValue fv)
Execute the 'very' modifier on a FuzzyValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Modifiers()
Method Detail |
public static void add(nrc.fuzzy.ModifierFunction mf)
mf
- the modifier function instancepublic static boolean isModifier(java.lang.String modifierName)
modifierName
- the modifier name as a string
public static java.lang.String[] getModifierNames()
public static nrc.fuzzy.FuzzyValue call(java.lang.String modifierName, nrc.fuzzy.FuzzyValue fv)
modifierName
- the modifier name as a string
public static nrc.fuzzy.FuzzySet call(java.lang.String modifierName, nrc.fuzzy.FuzzySet fs)
modifierName
- the modifier name as a stringfs
- the FuzzySet to modifiy
public static nrc.fuzzy.FuzzyValue not(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
NotModifier
public static nrc.fuzzy.FuzzySet not(nrc.fuzzy.FuzzySet fs)
NotModifier
public static nrc.fuzzy.FuzzyValue very(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
VeryModifier
public static nrc.fuzzy.FuzzySet very(nrc.fuzzy.FuzzySet fs)
VeryModifier
public static nrc.fuzzy.FuzzyValue extremely(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
ExtremelyModifier
public static nrc.fuzzy.FuzzySet extremely(nrc.fuzzy.FuzzySet fs)
ExtremelyModifier
public static nrc.fuzzy.FuzzyValue somewhat(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
SomewhatModifier
public static nrc.fuzzy.FuzzySet somewhat(nrc.fuzzy.FuzzySet fs)
SomewhatModifier
public static nrc.fuzzy.FuzzyValue more_or_less(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
MoreorlessModifier
public static nrc.fuzzy.FuzzySet more_or_less(nrc.fuzzy.FuzzySet fs)
MoreorlessModifier
public static nrc.fuzzy.FuzzyValue plus(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
PlusModifier
public static nrc.fuzzy.FuzzySet plus(nrc.fuzzy.FuzzySet fs)
PlusModifier
public static nrc.fuzzy.FuzzyValue norm(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
NormModifier
public static nrc.fuzzy.FuzzySet norm(nrc.fuzzy.FuzzySet fs)
NormModifier
public static nrc.fuzzy.FuzzyValue slightly(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
SlightlyModifier
public static nrc.fuzzy.FuzzySet slightly(nrc.fuzzy.FuzzySet fs)
SlightlyModifier
public static nrc.fuzzy.FuzzyValue intensify(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
IntensifyModifier
public static nrc.fuzzy.FuzzySet intensify(nrc.fuzzy.FuzzySet fs)
IntensifyModifier
public static nrc.fuzzy.FuzzyValue above(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
AboveModifier
public static nrc.fuzzy.FuzzySet above(nrc.fuzzy.FuzzySet fs)
AboveModifier
public static nrc.fuzzy.FuzzyValue below(nrc.fuzzy.FuzzyValue fv)
fv
- the fuzzy value to be modified
BelowModifier
public static nrc.fuzzy.FuzzySet below(nrc.fuzzy.FuzzySet fs)
BelowModifier
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |