Ejemplo n.º 1
0
  public EV1FormBackingObject convertToFormBackingObject(EV1Model ev1Model) {
    EV1FormBackingObject ev1FormBackingObject = new EV1FormBackingObject(true);

    // filling groupValues
    NumbersList groupValues = ev1Model.getmGroupValues();
    List<NumbersListEntry> listOfEntries = groupValues.getNumbersListEntries();
    List<Double> fboGroupValues = new ArrayList<Double>(); // will store the result

    for (NumbersListEntry nle : listOfEntries) {
      fboGroupValues.add(nle.getEntry(), nle.getValue());
    }
    // filling paramValues
    ListOfList paramValues = ev1Model.getmParamValues();
    List<ListOfListEntry> listOfListEntries = paramValues.getListOfListEntries(); // depth 1
    List<ArrayList<Double>> fboParamValues = new ArrayList<ArrayList<Double>>();

    for (ListOfListEntry lle : listOfListEntries) {
      NumbersList groupOfParams = lle.getNumbersList();
      List<NumbersListEntry> tempListOfEntries = groupOfParams.getNumbersListEntries(); // depth 2
      ArrayList<Double> tempListOfValues = new ArrayList<Double>();
      for (NumbersListEntry nle : tempListOfEntries) {
        tempListOfValues.add(nle.getEntry(), nle.getValue()); // filling temporary list
      }
      fboParamValues.add(lle.getEntryOrder(), tempListOfValues); // putting list on place in list
    }

    ev1FormBackingObject.setEv1Value(ev1Model.getEv1value());
    ev1FormBackingObject.setmGroupValues(fboGroupValues);
    ev1FormBackingObject.setParameterValues(fboParamValues);

    // todo DANGEROUS perhaps causes arithmetic trouble
    // todo
    // todo VERY VERY DANGEROUS :)
    calculator.recalculateEV1GroupParameters(ev1FormBackingObject);

    return ev1FormBackingObject;
  }