Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class fcmFloatFuzzyValue
- {
- private float value;
- private float membership;
- /**
- * Constructs a new fuzzy value given a crisp value and its membership
- * @param value Real value
- * @param membership Membership should be within the interval [0, 1]
- */
- public fcmFloatFuzzyValue(float value, float membership)
- {
- setValue(value);
- setMembership(membership);
- }
- /**
- * Sets the membership of the current fuzzy value
- * @param membership Membership should be within the interval [0, 1]
- */
- public void setMembership(float membership)
- {
- if ( (membership >= 0) && (membership <= 1) )
- {
- this.membership = membership;
- }
- else
- {
- this.membership = -1; // invalid membership
- }
- }
- /**
- * Sets the crisp value of the fuzzy value
- * @param value Real value
- */
- public void setValue(float value)
- {
- this.value = value;
- }
- /**
- * Reads the membership value of the current fuzzy value
- * @return Membership value within the interval [0, 1]
- */
- public float getMembership()
- {
- return membership;
- }
- /**
- * Reads the crisp value of the current fuzzy value
- * @return Real value
- */
- public float getValue()
- {
- return value;
- }
- /**
- * Converts the current fuzzy value into a string
- * @return Returns the fuzzy value as a string
- */
- public String toString()
- {
- return value + " " + membership;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement