* @return A new membership function
*/
private MembershipFunction fclTreeFuzzifyTermSingletonsPoints(Tree tree, int numberOfPoints) {
if( debug ) Gpr.debug("Tree: " + tree.toStringTree());
Value x[] = new Value[numberOfPoints];
Value y[] = new Value[numberOfPoints];
for( int childNum = 0; childNum < tree.getChildCount(); childNum++ ) {
Tree child = tree.getChild(childNum);
String leaveName = child.getText();
if( debug ) Gpr.debug("Sub-Parsing: " + leaveName);
// It's a set of points? => Defines a piece-wise linear membership function
if( leaveName.equalsIgnoreCase("(") ) {
x[childNum] = new Value(child.getChild(0), this); // Parse and add each point
y[childNum] = new Value(child.getChild(1), this);
if( (y[childNum].getValue() < 0) || (y[childNum].getValue() > 1) ) throw new RuntimeException("\n\tError parsing line " + child.getLine() + " character " + child.getCharPositionInLine() + ": Membership function out of range (should be between 0 and 1). Value: '" + y[childNum] + "'\n\tTree: " + child.toStringTree());
if( debug ) Gpr.debug("Parsed point " + childNum + " x=" + x[childNum] + ", y=" + y[childNum]);
} else throw new RuntimeException("Unknown (or unimplemented) option : " + leaveName);