if (!Double.isNaN(value && value > 0.0) {
if (!Double.isNaN(value) && (value > 0.0)) {
    protected Enumeration generateProjections(Inventory inventory) {//  	printDebug("STEP 2:  GenerateProjections() for "+AssetUtils.getAssetIdentifier(inventory));	Vector projections = new Vector();	InventoryPG invpg = (InventoryPG)inventory.searchForPropertyGroup(InventoryPG.class);	int days = invpg.getPlanningDays();	int today = invpg.getFirstPlanningDay();	Scalar previous = invpg.getProjected(today);	Scalar current = null;	double safety;	int periodBegin = today;	boolean newCurrent = false;	long start;	int i=today;	//  	printDebug(0, "!!!!!!!!!!!!!!!!! first day of demand : "+TimeUtils.dateString(TimeUtils.addNDays(invpg.getStartTime(),today))+", INV START: "+TimeUtils.dateString(invpg.getStartTime()));	for (; i < days; i++) {	    current = invpg.getProjected(i);	    if (previous !=  null) {		//    		printDebug("generateProjections(), previous: "+previous+", current: "+current+", on day "+i);		if (!current.equals(previous)) {		    double value = convertScalarToDouble(previous);		    if (!Double.isNaN(value) && value > 0.0) {			start = TimeUtils.addNDays(invpg.getStartTime(), periodBegin);			// Period spans a single day			if (periodBegin == (i-1)) {			    // Subtract 12 hours from the start time to ensure a non-zero time span			    start = start - (TimeUtils.MSEC_PER_HOUR*12);			}			// safety accounts for the safety level which the inventory attempts to maintain.			// add the safety 'demand' to projected deman.			safety = determineSafetyIncrement(periodBegin, i-1, inventory);			Task t = newProjectSupplyTask(inventory, start,						      TimeUtils.addNDays(invpg.getStartTime(), i-1), 						      createIncrementedDailyRate(previous,safety));//  			if(safety>0){//  			    printDebug(0, "  !!! projection with dailyRate=" + createDailyRate(previous)+" and safetyRate="+safety);//  			}			projections.add(t);			invpg.addDueIn(t);			//      			printDebug("generateProjections(), created Projection task. Start: "+TimeUtils.dateString(start)+", End: "+			//  				   TimeUtils.dateString(TimeUtils.addNDays(invpg.getStartTime(), i))+", Value: "+previous);		    }		    periodBegin = i;		    newCurrent = false;		}		else {		    newCurrent = true;		}	    }	    previous = current;	}	if ((newCurrent) && (previous != null)) {	    double value = convertScalarToDouble(previous);	    if (!Double.isNaN(value && value > 0.0) {		start = TimeUtils.addNDays(invpg.getStartTime(), periodBegin);		// Period spans a single day		if (periodBegin == (days-1)) {		    // Subtract 12 hours from the start time to ensure a non-zero time span		    start = start - (TimeUtils.MSEC_PER_HOUR*12);		}		safety = determineSafetyIncrement(periodBegin, days-1, inventory);		Task t = newProjectSupplyTask(inventory, start,					      TimeUtils.addNDays(invpg.getStartTime(), days-1), 					      createIncrementedDailyRate(previous,safety));		//  		printDebug(0, "!!!!!!!!!!!!!!!!!!!! projection with dailyRate=" +		//  			   createDailyRate(previous)+" and safetyRate="+safety+"\n        Task: "+ TaskUtils.taskDesc(t));		projections.add(t);		invpg.addDueIn(t);	    }	    //  	    printDebug("generateProjections(), previous: "+previous+", current: "+current);	}