public int clearInventoryLevelsSchedule(Inventory inventory) { if (!isStartTimeSet) return -1; InventoryLevelsPG ilp = inventory.getInventoryLevelsPG(); QuantityScheduleElement dse,rlse,glse; Vector new_av_demand_elements = new Vector(); Vector new_reorder_elements = new Vector(); Vector new_goal_elements = new Vector(); long start = TimeUtils.addNDaysTime(getStartTime(), 0); long end = TimeUtils.addNDaysTime(getStartTime(), 30);  dse = ScheduleUtils.buildQuantityScheduleElement(0, start, end); rlse = ScheduleUtils.buildQuantityScheduleElement(0, start, end); glse = ScheduleUtils.buildQuantityScheduleElement(0, start, end); new_av_demand_elements.add(dse); new_reorder_elements.add(rlse); new_goal_elements.add(glse);  Schedule new_av_demand_schedule = GLMFactory.newQuantitySchedule(new_av_demand_elements.elements(), PlanScheduleType.TOTAL_INVENTORY); Schedule new_reorder_schedule = GLMFactory.newQuantitySchedule(new_reorder_elements.elements(), PlanScheduleType.TOTAL_INVENTORY); Schedule new_goal_schedule = GLMFactory.newQuantitySchedule(new_goal_elements.elements(), PlanScheduleType.TOTAL_INVENTORY);  if (ScheduleUtils.isOffendingSchedule(new_av_demand_schedule)) { GLMDebug.ERROR("InventoryBG", "clearInventoryLevelSchedule(),  CREATED BAD nDays SCHEDULE  "); printQuantityScheduleTimes(new_av_demand_schedule); } if (ScheduleUtils.isOffendingSchedule(new_reorder_schedule)) { GLMDebug.ERROR("InventoryBG", "clearInventoryLevelSchedule(),  CREATED BAD reorder SCHEDULE  "); printQuantityScheduleTimes(new_reorder_schedule); } if (ScheduleUtils.isOffendingSchedule(new_goal_schedule)) { GLMDebug.ERROR("InventoryBG", "clearInventoryLevelSchedule(),  CREATED BAD goal SCHEDULE  "); printQuantityScheduleTimes(new_goal_schedule); } ((NewInventoryLevelsPG)ilp).setAverageDemandSchedule(new_av_demand_schedule); ((NewInventoryLevelsPG)ilp).setReorderLevelSchedule(new_reorder_schedule); ((NewInventoryLevelsPG)ilp).setGoalLevelSchedule(new_goal_schedule);  return 0;  }    public int printQuantityScheduleTimes(Schedule sched) { Enumeration elements = sched.getAllScheduleElements(); QuantityScheduleElement qse;  while (elements.hasMoreElements()) { qse = (QuantityScheduleElement)elements.nextElement(); if(GLMDebug.printDebug()) GLMDebug.DEBUG("InventoryBG", "printQuantityScheduleTimes()    qty: "+qse.getQuantity()+ " "+qse.getStartTime()+" to "+ qse.getEndTime()); } return 0; }  public abstract PGDelegate copy(PropertyGroup pg);   public void addInventoryReport(InventoryReport newInventoryReport) { synchronized (this) { report_history.add(newInventoryReport); if (latest_report == null || latest_report.theReportDate < newInventoryReport.theReportDate) { latest_report = newInventoryReport; } if (oldest_report == null || oldest_report.theReportDate > newInventoryReport.theReportDate) { oldest_report = newInventoryReport; } } if(GLMDebug.printDebug()) GLMDebug.DEBUG("InventoryBG", "addInventoryReport(), Report added!!!!!!! : "+this.hashCode()); }   public void pruneOldInventoryReports(long pruneTime) { synchronized (this) { for (Iterator i = report_history.iterator(); i.hasNext(); ) { InventoryReport report = (InventoryReport) i.next(); if (pruneTime > report.theReportDate && report != latest_report) { i.remove(); } } oldest_report = null; } }   private ArrayList getInventoryReportHistory() { synchronized (this) { return report_history; } }   public InventoryReport getLatestInventoryReport() { synchronized (this) { if (latest_report == null) { for (Iterator i = report_history.iterator(); i.hasNext(); ) { InventoryReport report = (InventoryReport) i.next(); if (latest_report == null || latest_report.theReportDate < report.theReportDate) { latest_report = report; } }
    public int clearContentSchedule(Inventory inventory) {	if (!isStartTimeSet) return -1;	ScheduledContentPG scp = inventory.getScheduledContentPG();	Schedule sched = scp.getSchedule();	QuantityScheduleElement qse;	Vector new_elements = new Vector();        long start = TimeUtils.addNDaysTime(getStartTime(), 0);        long end = TimeUtils.addNDaysTime(getStartTime(), 30);	        qse = ScheduleUtils.buildQuantityScheduleElement(getDouble(myPG_.getInitialLevel()), start, end);        new_elements.add(qse);	Schedule new_schedule = GLMFactory.newQuantitySchedule(new_elements.elements(), 							       PlanScheduleType.TOTAL_INVENTORY);	if (ScheduleUtils.isOffendingSchedule(new_schedule)) {	    GLMDebug.ERROR("InventoryBG", "UpdateContentSchedule(),  CREATED BAD SCHEDULE "); 	    printQuantityScheduleTimes(new_schedule);	}	((NewScheduledContentPG)scp).setSchedule(new_schedule);	return 0;     }