net.sourceforge.jfl.core
Class DiscreteFuzzySet<T>

java.lang.Object
  extended by net.sourceforge.jfl.core.DiscreteFuzzySet<T>
Type Parameters:
T -
All Implemented Interfaces:
java.lang.Cloneable, IFuzzySet<T>

public class DiscreteFuzzySet<T>
extends java.lang.Object
implements IFuzzySet<T>, java.lang.Cloneable

This class implements the IFuzzySet interface, backed by a HashMap instance. This implementation not allows null element.

Author:
arons777@users.sourceforge.net

Field Summary
protected  boolean complementary
           
protected  java.lang.String label
           
protected  java.util.Map<T,java.lang.Double> map
           
 
Constructor Summary
DiscreteFuzzySet()
           
DiscreteFuzzySet(int initialCapacity)
           
 
Method Summary
 void addAllElement(java.util.Set<T> elements, double membership)
          If the fuzzy set previously contained an element of the set, the old membership value of this element is replaced by membership passed.
 void addElement(T element, double membership)
          Add the element to the set.
 DiscreteFuzzySet<T> and(IFuzzySet<T> anotherSet)
          Performs a fuzzy logic and between this fuzzy set and the given one
 DiscreteFuzzySet<T> clone()
           
 DiscreteFuzzySet<T> complement()
          Create the complement of the fuzzy set.
 java.lang.String getLabel()
          Returns the label of this fuzzy set.
 double getMembership(T element)
          returns the membership value of the provided element to this IFuzzySet.
 java.util.Set<T> getSupport()
          Gets the fuzzy set support or, in other words, all the elements with non zero membership value.
 java.util.Set<Interval> getSupportIntervals()
          Gets the fuzzy set support or, in other words, all the elements with non zero membership value.
 DiscreteFuzzySet<T> or(IFuzzySet<T> anotherSet)
          Performs a fuzzy logic or between this fuzzy set and the given one
 double removeElement(T element)
          Remove the element from the set.
 void setLabel(java.lang.String label)
          Sets this fuzzy set label.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

protected java.lang.String label

map

protected java.util.Map<T,java.lang.Double> map

complementary

protected boolean complementary
Constructor Detail

DiscreteFuzzySet

public DiscreteFuzzySet()

DiscreteFuzzySet

public DiscreteFuzzySet(int initialCapacity)
Parameters:
initialCapacity - initial capacity of the set.
Method Detail

getLabel

public java.lang.String getLabel()
Description copied from interface: IFuzzySet
Returns the label of this fuzzy set.

Specified by:
getLabel in interface IFuzzySet<T>
Returns:
the label of this fuzzy set.

setLabel

public void setLabel(java.lang.String label)
Description copied from interface: IFuzzySet
Sets this fuzzy set label. A fuzzy set label is just an human readable name for the fuzzy set.

Specified by:
setLabel in interface IFuzzySet<T>
Parameters:
label - the label to set

getMembership

public double getMembership(T element)
Description copied from interface: IFuzzySet
returns the membership value of the provided element to this IFuzzySet.

Specified by:
getMembership in interface IFuzzySet<T>
Parameters:
element - the element of which we want the membership value for this IFuzzySet
Returns:
the membership value of the queried element

getSupport

public java.util.Set<T> getSupport()
Description copied from interface: IFuzzySet
Gets the fuzzy set support or, in other words, all the elements with non zero membership value.

Specified by:
getSupport in interface IFuzzySet<T>
Returns:
null if there no posibility to know the support. (example if this set is a complement of a set).

getSupportIntervals

public java.util.Set<Interval> getSupportIntervals()
Description copied from interface: IFuzzySet
Gets the fuzzy set support or, in other words, all the elements with non zero membership value.

Specified by:
getSupportIntervals in interface IFuzzySet<T>
Returns:
the fuzzy set support intervals, null if is not possible to return the support as interval.

addAllElement

public void addAllElement(java.util.Set<T> elements,
                          double membership)
If the fuzzy set previously contained an element of the set, the old membership value of this element is replaced by membership passed.


addElement

public void addElement(T element,
                       double membership)
Add the element to the set. If the fuzzy set previously contained the element, the old membership value is replaced by membership passed.

Parameters:
element - the element to add
membership - the membership values to set.

removeElement

public double removeElement(T element)
Remove the element from the set.

Parameters:
element -
Returns:
the old memebership values

complement

public DiscreteFuzzySet<T> complement()
Create the complement of the fuzzy set.

Specified by:
complement in interface IFuzzySet<T>
Returns:

clone

public DiscreteFuzzySet<T> clone()
Overrides:
clone in class java.lang.Object

and

public DiscreteFuzzySet<T> and(IFuzzySet<T> anotherSet)
Description copied from interface: IFuzzySet
Performs a fuzzy logic and between this fuzzy set and the given one

Specified by:
and in interface IFuzzySet<T>
Parameters:
anotherSet - the fuzzy set to perform the fuzzy logic and with
Returns:
the fuzzy set resulting from the and between this fuzzy set and the given one.

or

public DiscreteFuzzySet<T> or(IFuzzySet<T> anotherSet)
Description copied from interface: IFuzzySet
Performs a fuzzy logic or between this fuzzy set and the given one

Specified by:
or in interface IFuzzySet<T>
Parameters:
anotherSet - the fuzzy set to perform the fuzzy logic or with
Returns:
the fuzzy set resulting from the or between this fuzzy set and the given one.


Copyright © 2000 Dummy Corp. All Rights Reserved.