private void addCalculateCrispValue(Program program, Java.CLASS clazz) {

		Java.METHOD calc = clazz.addMETHOD("private", "Number", "calculateCrispValue");
		calc.setComment("Calculate the crisp value");
		calc.setReturnComment("the crisp value");
		calc.addArg("Number", "from", "Start interval");
		calc.addArg("Number", "to", "End interval");
		calc.addArg("Number", "step", "Interval step");
		calc.addArg("double[]", "fuzzy", "Fuzzy value");

		calc.addS("double area = 0.0");
		calc.addS("double moment = 0.0");

		Java.FOR fout = calc.addFOR("int i = 0", "i < fuzzy.length", "i++");
		fout.addS("double normalized = from.doubleValue() + (step.doubleValue() * i)");
		fout.addS("area += fuzzy[i]");
		fout.addS("moment += fuzzy[i] * normalized");
		calc.addS("double crisp = Math.abs(area) < " + program.getEpsilon() + " ? "
				+ "to.doubleValue() + step.doubleValue() : moment / area");
		calc.addRETURN("Math.abs(crisp) > " + program.getEpsilon() + " ? crisp : 0.0");

	}
private void addCalculateCrispValue ( Program program , Java . CLASS clazz ) { Java . METHOD calc = clazz . addMETHOD ( "private" , "Number" , "calculateCrispValue" ) ; calc . setComment ( "Calculate the crisp value" ) ; calc . setReturnComment ( "the crisp value" ) ; calc . addArg ( "Number" , "from" , "Start interval" ) ; calc . addArg ( "Number" , "to" , "End interval" ) ; calc . addArg ( "Number" , "step" , "Interval step" ) ; calc . addArg ( "double[]" , "fuzzy" , "Fuzzy value" ) ; calc . addS ( "double area = 0.0" ) ; calc . addS ( "double moment = 0.0" ) ; Java . FOR fout = calc . addFOR ( "int i = 0" , "i < fuzzy.length" , "i++" ) ; fout . addS ( "double normalized = from.doubleValue() + (step.doubleValue() * i)" ) ; fout . addS ( "area += fuzzy[i]" ) ; fout . addS ( "moment += fuzzy[i] * normalized" ) ; calc . addS ( "double crisp = Math.abs(area) < " + program . getEpsilon ( ) + " ? " + "to.doubleValue() + step.doubleValue() : moment / area" ) ; calc . addRETURN ( "Math.abs(crisp) > " + program . getEpsilon ( ) + " ? crisp : 0.0" ) ; }
Calculate the crisp output value.
<p>
@param method   the calling method
@param variable the output variable