// For each linguistic term...
int j = 0;
for( Iterator it = iteratorLinguisticTermNames(); it.hasNext(); j++ ) {
// Add this linguistic term to dataset
String termName = (String) it.next();
MembershipFunction membershipFunction = getLinguisticTerm(termName).getMembershipFunction();
discrete &= membershipFunction.isDiscrete();
// Create a series and add points
XYSeries series = new XYSeries(termName);
if( membershipFunction.isDiscrete() ) {
// Discrete case: Evaluate membership function and add points to dataset
MembershipFunctionDiscrete membershipFunctionDiscrete = (MembershipFunctionDiscrete) membershipFunction;
numberOfPoints = membershipFunctionDiscrete.size();
for( int i = 0; i < numberOfPoints; i++ )
series.add(membershipFunctionDiscrete.valueX(i), membershipFunctionDiscrete.membership(i));
} else {
// Continuous case: Add every membershipfunction's point
numberOfPoints = PlotWindow.DEFAULT_CHART_NUMBER_OF_POINTS;
double xx = universeMin;
for( int i = 0; i < numberOfPoints; i++, xx += step )
series.add(xx, membershipFunction.membership(xx));
}
// Add series to dataSet
xyDataset.addSeries(series);
}