Example #1
0
  private String demandToString() {
    Iterator<Years> yrItr = demandMap.keySet().iterator();
    Map<LocalDate, Demand> currDemandMap;
    Years currYr;
    LocalDate currDate;
    Demand currDemand;

    StringBuffer epDemandBf = new StringBuffer();
    epDemandBf.append("epDemand|");

    StringBuffer rcActualDemandBf = new StringBuffer();
    rcActualDemandBf.append("rcActualDemand|");

    StringBuffer rcDemandBf = new StringBuffer();
    rcDemandBf.append("rcDemand|");

    StringBuffer rcAvgDemandBf = new StringBuffer();
    rcAvgDemandBf.append("rcAvgDemand|");

    StringBuffer rcAvgDemandActualBf = new StringBuffer();
    rcAvgDemandActualBf.append("rcAvgDemandActual|");

    while (yrItr.hasNext()) {
      currYr = yrItr.next();
      currDemandMap = demandMap.get(currYr);
      Iterator<LocalDate> itr = currDemandMap.keySet().iterator();
      while (itr.hasNext()) {
        currDate = itr.next();
        currDemand = currDemandMap.get(currDate);
        // ep demand
        epDemandBf.append(currDate);
        epDemandBf.append(":");
        epDemandBf.append(currDemand.getEpDemand());
        epDemandBf.append("|");
        // actual demand
        rcActualDemandBf.append(currDate);
        rcActualDemandBf.append(":");
        rcActualDemandBf.append(currDemand.getRcDemandActual());
        rcActualDemandBf.append("|");
        // rc demand
        rcDemandBf.append(currDate);
        rcDemandBf.append(":");
        rcDemandBf.append(currDemand.getRcDemand());
        rcDemandBf.append("|");
        // rc average demand
        rcAvgDemandBf.append(currDate);
        rcAvgDemandBf.append(":");
        rcAvgDemandBf.append(currDemand.getRcAvgDemand());
        rcAvgDemandBf.append("|");
        // rc average demand actual
        rcAvgDemandActualBf.append(currDate);
        rcAvgDemandActualBf.append(":");
        rcAvgDemandActualBf.append(currDemand.getRcAvgDemandActual());
        rcAvgDemandActualBf.append("|");
      }
    }
    rcActualDemandBf.append(";\n");
    epDemandBf.append(";\n");
    rcDemandBf.append(";\n");
    rcAvgDemandBf.append(";\n");
    rcAvgDemandActualBf.append(";\n");

    StringBuffer retBf = new StringBuffer();
    retBf.append(epDemandBf.toString());
    retBf.append(rcActualDemandBf.toString());
    retBf.append(rcDemandBf.toString());
    retBf.append(rcAvgDemandBf.toString());
    retBf.append(rcAvgDemandActualBf.toString());
    retBf.append("\n");

    return retBf.toString();
  }
Example #2
0
  private String inventoryToString() {
    StringBuffer epAvgInvBf = new StringBuffer();
    epAvgInvBf.append("epAvgInv|");

    StringBuffer epEopInvBf = new StringBuffer();
    epEopInvBf.append("epEopInv|");

    StringBuffer epInvOutBf = new StringBuffer();
    epInvOutBf.append("epInvOut|");

    StringBuffer epInvInBf = new StringBuffer();
    epInvInBf.append("epInvIn|");

    StringBuffer rcBopInvBf = new StringBuffer();
    rcBopInvBf.append("rcBopInv|");

    StringBuffer rcInvInBf = new StringBuffer();
    rcInvInBf.append("rcInvIn|");

    StringBuffer rcInvOutBf = new StringBuffer();
    rcInvOutBf.append("rcInvOut|");

    StringBuffer actualInvBf = new StringBuffer();
    actualInvBf.append("actualInv|");

    Iterator<Years> yrItr = inventoryMap.keySet().iterator();
    Map<LocalDate, ProductInventory> currInvMap;
    LocalDate currDate;
    Years currYr;
    ProductInventory currInv;
    // Populate Sale buffers
    while (yrItr.hasNext()) {
      currYr = yrItr.next();
      currInvMap = inventoryMap.get(currYr);
      Iterator<LocalDate> itr = currInvMap.keySet().iterator();
      while (itr.hasNext()) {
        currDate = itr.next();
        currInv = currInvMap.get(currDate);
        // epAvgInv
        epAvgInvBf.append(currDate);
        epAvgInvBf.append(":");
        epAvgInvBf.append(currInv.getEpAvgInv());
        epAvgInvBf.append("|");
        // epEopInv
        epEopInvBf.append(currDate);
        epEopInvBf.append(":");
        epEopInvBf.append(currInv.getEpEopInv());
        epEopInvBf.append("|");
        // epInvOut
        epInvOutBf.append(currDate);
        epInvOutBf.append(":");
        epInvOutBf.append(currInv.getEpInvOut());
        epInvOutBf.append("|");
        // epInvIn
        epInvInBf.append(currDate);
        epInvInBf.append(":");
        epInvInBf.append(currInv.getEpInvIn());
        epInvInBf.append("|");

        // rcBopInv
        rcBopInvBf.append(currDate);
        rcBopInvBf.append(":");
        rcBopInvBf.append(currInv.getRcBopInv());
        rcBopInvBf.append("|");
        // rcInvInBf
        rcInvInBf.append(currDate);
        rcInvInBf.append(":");
        rcInvInBf.append(currInv.getRcInvIn());
        rcInvInBf.append("|");
        // rcInvOut
        rcInvOutBf.append(currDate);
        rcInvOutBf.append(":");
        rcInvOutBf.append(currInv.getRcInvOut());
        rcInvOutBf.append("|");
        // ActualInv
        actualInvBf.append(currDate);
        actualInvBf.append(":");
        actualInvBf.append(currInv.getInventory());
        actualInvBf.append("|");
      }
    }
    epAvgInvBf.append(";\n");
    epEopInvBf.append(";\n");
    epInvOutBf.append(";\n");
    epInvInBf.append(";\n");
    actualInvBf.append(";\n");

    rcBopInvBf.append(";\n");
    rcInvInBf.append(";\n");
    rcInvOutBf.append(";\n");

    StringBuffer retBf = new StringBuffer();
    retBf.append(epAvgInvBf.toString());
    retBf.append(epEopInvBf.toString());
    retBf.append(epInvOutBf.toString());
    retBf.append(epInvInBf.toString());
    retBf.append(actualInvBf.toString());
    retBf.append(rcBopInvBf.toString());
    retBf.append(rcInvInBf.toString());
    retBf.append(rcInvOutBf.toString());
    retBf.append("\n");

    return retBf.toString();
  }
Example #3
0
  private String salesToString() {
    StringBuffer epSalesActualBf = new StringBuffer();
    epSalesActualBf.append("epSalesActual|");

    StringBuffer epSalesBf = new StringBuffer();
    epSalesBf.append("epSales|");

    StringBuffer rcSalesBf = new StringBuffer();
    rcSalesBf.append("rcSales|");

    StringBuffer rcAvgSalesBf = new StringBuffer();
    rcAvgSalesBf.append("rcAvgSales|");

    StringBuffer rcSalesActualBf = new StringBuffer();
    rcSalesActualBf.append("rcSalesActual|");

    StringBuffer rcAvgSalesActualBf = new StringBuffer();
    rcAvgSalesActualBf.append("rcAvgSalesActual|");

    Iterator<Years> yrItr = salesMap.keySet().iterator();
    Map<LocalDate, Sales> currSalesMap;
    LocalDate currDate;
    Years currYr;
    Sales currSale;
    // Populate Sale buffers
    while (yrItr.hasNext()) {
      currYr = yrItr.next();
      currSalesMap = salesMap.get(currYr);
      Iterator<LocalDate> itr = currSalesMap.keySet().iterator();
      while (itr.hasNext()) {
        currDate = itr.next();
        currSale = currSalesMap.get(currDate);
        // epSaleActual
        epSalesActualBf.append(currDate);
        epSalesActualBf.append(":");
        epSalesActualBf.append(currSale.getEpSalesActual());
        epSalesActualBf.append("|");
        // epSale
        epSalesBf.append(currDate);
        epSalesBf.append(":");
        epSalesBf.append(currSale.getEpSales());
        epSalesBf.append("|");
        // rc sales actual
        rcSalesActualBf.append(currDate);
        rcSalesActualBf.append(":");
        rcSalesActualBf.append(currSale.getRcSalesActual());
        rcSalesActualBf.append("|");
        // rc average sales actual
        rcAvgSalesActualBf.append(currDate);
        rcAvgSalesActualBf.append(":");
        rcAvgSalesActualBf.append(currSale.getRcAvgSalesActual());
        rcAvgSalesActualBf.append("|");
        // rc sales
        rcSalesBf.append(currDate);
        rcSalesBf.append(":");
        rcSalesBf.append(currSale.getRcSales());
        rcSalesBf.append("|");
        // rc sales average
        rcAvgSalesBf.append(currDate);
        rcAvgSalesBf.append(":");
        rcAvgSalesBf.append(currSale.getRcAvgSales());
        rcAvgSalesBf.append("|");
      }
    }
    epSalesActualBf.append(";\n");
    epSalesBf.append(";\n");
    rcSalesActualBf.append(";\n");
    rcAvgSalesActualBf.append(";\n");
    rcSalesBf.append(";\n");
    rcAvgSalesBf.append(";\n");

    StringBuffer retBf = new StringBuffer();
    retBf.append(epSalesActualBf.toString());
    retBf.append(epSalesBf.toString());
    retBf.append(rcSalesActualBf.toString());
    retBf.append(rcAvgSalesActualBf.toString());
    retBf.append(rcSalesBf.toString());
    retBf.append(rcAvgSalesBf.toString());
    retBf.append("\n");

    return retBf.toString();
  }