reasoner
Class Trapezoid

java.lang.Object
  extended by reasoner.Trapezoid
All Implemented Interfaces:
FuzzySet
Direct Known Subclasses:
ConcreteConcept, Quantifier

public class Trapezoid
extends java.lang.Object
implements FuzzySet

This class represents a FuzzySet having trapezoidal membership function, delimited by 4 point: first and last having 0.0 value, second and third having 1.0 value.

Author:
marco furlan

Field Summary
private  java.lang.Double a
           
private  java.lang.Double b
           
private  java.lang.Double c
           
private  java.lang.Double d
           
protected  java.text.NumberFormat formatter
           
protected  double maxval
           
protected  java.lang.String meaning
           
protected  double minval
           
protected  java.lang.String name
           
protected static java.lang.String patternAround
           
protected static java.lang.String patternBetween
           
private static double v1
           
private static double v2
           
 
Constructor Summary
Trapezoid()
          constructor for the null trapezoid
Trapezoid(java.lang.Double a1, java.lang.Double b1, java.lang.Double c1, java.lang.Double d1)
          Constructor by the 4 vertices
Trapezoid(java.lang.String name)
          Constructor by name: configures the vertices, knowing this Trapezoid name
 
Method Summary
 java.lang.Integer card(java.lang.Double alpha1, java.lang.String mode)
          Gives the integer cardinality at the given alpha level.
 Trapezoid diff(Trapezoid t)
          Fuzzy Set difference between this Trapezoid and a second one
protected  void fixVertices()
          Fixes vertices to be internal to boundary min and max values
protected  java.lang.Double geta()
           
static boolean getAroundValue(java.lang.String name)
          If the given name matches with "Around(
protected  java.lang.Double getb()
           
static boolean getBetweenValue(java.lang.String name)
          If the given name matches with "Between(...)and(
protected  java.lang.Double getc()
           
protected  java.lang.Double getd()
           
protected  java.util.Vector<java.lang.Double> getKeys()
           
 java.util.TreeSet<java.lang.Double> getLambda()
          Gives Lambda, the alpha level set for membership values
 double getMaxval()
           
 java.lang.String getMeaning()
           
 double getMinval()
           
 java.lang.String getName()
           
protected  java.util.Vector<java.lang.Double> getVertValues()
           
 Trapezoid intersection(FuzzySet f)
          Intersection with a FuzzySet
protected  void print()
          Prints on the standard output a String representation for this Trapezoid
 Trapezoid prod(Trapezoid t)
          Fuzzy Set product between this Trapezoid and a second one
 java.lang.Double qvalue(java.lang.Double d)
          Evaluation on this Trapezoid, for a given position
 Trapezoid ratio(Trapezoid t)
          Fuzzy Set ratio between this Trapezoid and a second one.
protected  void seta(java.lang.Double a1)
           
protected  void setb(java.lang.Double b1)
           
protected  void setc(java.lang.Double c1)
           
protected  void setd(java.lang.Double d1)
           
 void setMaxval(double maxval)
           
protected  void setMeaning()
          Sets the meaning, for some particular cases.
 void setMeaning(java.lang.String meaning)
           
 void setMinval(double minval)
           
 void setName(java.lang.String name1)
           
protected  void setVertices(java.lang.Double a1, java.lang.Double b1, java.lang.Double c1, java.lang.Double d1)
          Set the vertices
 Trapezoid sum(Trapezoid t)
          Fuzzy Set sum between this Trapezoid and a second one
 java.lang.String toString()
          return a String representation for this Trapezoid as a sequence of vertices
 Trapezoid union(FuzzySet f)
          Union with a FuzzySet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

a

private java.lang.Double a

b

private java.lang.Double b

c

private java.lang.Double c

d

private java.lang.Double d

maxval

protected double maxval

minval

protected double minval

name

protected java.lang.String name

meaning

protected java.lang.String meaning

patternAround

protected static final java.lang.String patternAround
See Also:
Constant Field Values

patternBetween

protected static final java.lang.String patternBetween
See Also:
Constant Field Values

v1

private static double v1

v2

private static double v2

formatter

protected java.text.NumberFormat formatter
Constructor Detail

Trapezoid

public Trapezoid()
constructor for the null trapezoid


Trapezoid

public Trapezoid(java.lang.Double a1,
                 java.lang.Double b1,
                 java.lang.Double c1,
                 java.lang.Double d1)
Constructor by the 4 vertices

Parameters:
a1 - the first vertice
b1 - the second vertice
c1 - the third vertice
d1 - the fourth vertice

Trapezoid

public Trapezoid(java.lang.String name)
Constructor by name: configures the vertices, knowing this Trapezoid name

Parameters:
name - the name
Method Detail

setVertices

protected void setVertices(java.lang.Double a1,
                           java.lang.Double b1,
                           java.lang.Double c1,
                           java.lang.Double d1)
Set the vertices

Parameters:
a1 - the first vertice
b1 - the second vertice
c1 - the third vertice
d1 - the fourth vertice

getAroundValue

public static boolean getAroundValue(java.lang.String name)
If the given name matches with "Around(...)", extracts the referred value and return true

Parameters:
name - the name
Returns:
true if name matches, false otherwise

getBetweenValue

public static boolean getBetweenValue(java.lang.String name)
If the given name matches with "Between(...)and(...)", extracts the two referred values and return true

Parameters:
name - the name
Returns:
true if name matches, false otherwise

setMeaning

protected void setMeaning()
Sets the meaning, for some particular cases.


getd

protected java.lang.Double getd()
Returns:
the d vertice

getc

protected java.lang.Double getc()
Returns:
the c vertice

getb

protected java.lang.Double getb()
Returns:
the b vertice

geta

protected java.lang.Double geta()
Returns:
the a vertice

setd

protected void setd(java.lang.Double d1)
Parameters:
d1 - the new d value

setc

protected void setc(java.lang.Double c1)
Parameters:
c1 - the new c value

setb

protected void setb(java.lang.Double b1)
Parameters:
b1 - the new b value

seta

protected void seta(java.lang.Double a1)
Parameters:
a1 - the new a value

toString

public java.lang.String toString()
return a String representation for this Trapezoid as a sequence of vertices

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

sum

public Trapezoid sum(Trapezoid t)
Fuzzy Set sum between this Trapezoid and a second one

Parameters:
t - the second Trapezoid
Returns:
the sum Trapezoid

diff

public Trapezoid diff(Trapezoid t)
Fuzzy Set difference between this Trapezoid and a second one

Parameters:
t - the second Trapezoid
Returns:
the difference Trapezoid

prod

public Trapezoid prod(Trapezoid t)
Fuzzy Set product between this Trapezoid and a second one

Parameters:
t - the second Trapezoid
Returns:
the product Trapezoid

ratio

public Trapezoid ratio(Trapezoid t)
Fuzzy Set ratio between this Trapezoid and a second one. Possible for divisor Trapezoid not zero containing only!

Parameters:
t - the second Trapezoid
Returns:
the ratio Trapezoid

fixVertices

protected void fixVertices()
Fixes vertices to be internal to boundary min and max values


intersection

public Trapezoid intersection(FuzzySet f)
Intersection with a FuzzySet

Parameters:
f - the FuzzySet
Returns:
the intersection

union

public Trapezoid union(FuzzySet f)
Union with a FuzzySet

Parameters:
f - the FuzzySet
Returns:
the union

getKeys

protected java.util.Vector<java.lang.Double> getKeys()
Returns:
a Vector containing vertices positions.

getVertValues

protected java.util.Vector<java.lang.Double> getVertValues()
Returns:
a Vector containing vertices values.

qvalue

public java.lang.Double qvalue(java.lang.Double d)
Evaluation on this Trapezoid, for a given position

Parameters:
d - the position
Returns:
the Double value

getMaxval

public double getMaxval()
Returns:
the maxval

setMaxval

public void setMaxval(double maxval)
Parameters:
maxval - the maxval to set

getMinval

public double getMinval()
Returns:
the minval

setMinval

public void setMinval(double minval)
Parameters:
minval - the minval to set

getName

public java.lang.String getName()
Returns:
the name

setName

public void setName(java.lang.String name1)
Parameters:
name1 - the name to set

card

public java.lang.Integer card(java.lang.Double alpha1,
                              java.lang.String mode)
Gives the integer cardinality at the given alpha level. The String mode operates selection over Individuals.

Specified by:
card in interface FuzzySet
Parameters:
alpha1 - the given alpha level
mode - the selecting String
Returns:
the cardinality

getLambda

public java.util.TreeSet<java.lang.Double> getLambda()
Gives Lambda, the alpha level set for membership values

Specified by:
getLambda in interface FuzzySet
Returns:
Lambda as a TreeSet

print

protected void print()
Prints on the standard output a String representation for this Trapezoid


getMeaning

public java.lang.String getMeaning()
Returns:
the meaning

setMeaning

public void setMeaning(java.lang.String meaning)
Parameters:
meaning - the meaning to set