flexoffer-tutorial/src/main/java/org/arrowhead/wp5/flexoffer/tutorial/MyDER.java
public void generateFlexOffer() {
        FlexOffer flexOffer = new FlexOffer();
        /*
         * Here we just use static value to populate the slices of the flexoffer
         */
        List<FlexOfferSlice> slices = new ArrayList<FlexOfferSlice>();
        int loadLow[] = new int[] { -500, 1700, -1050, 1100, 500, 1400, 400 };
        int loadHigh[] = new int[] { 500, 1732, -500, 1168, 552, 1471, 453 };
        int sliceDuration = 4;

        for (int i = 0; i < loadLow.length; i++) {
            slices.add(new FlexOfferSlice(sliceDuration, 1, loadLow[i], loadHigh[i]));
        }

        flexOffer.setSlices(slices.toArray(flexOffer.getSlices()));

        /*Need to set some time parameter of the flexoffer*/
        Date ct = new java.util.Date();
        flexOffer.setCreationTime(ct);

        Calendar cal = Calendar.getInstance();
        
        cal.add(Calendar.MINUTE, 30);

        cal.add(Calendar.MINUTE, 1);
        /*Time before aggregator needs to send back acceptance*/
        flexOffer.setAcceptanceBeforeTime(cal.getTime());

        cal.add(Calendar.MINUTE, 1);
        /*Time before aggregator needs to send back schedule*/
        flexOffer.setAssignmentBeforeTime(cal.getTime());

        cal.add(Calendar.MINUTE, 10);
        /*Minimum time at which the consumption pattern can start*/
        flexOffer.setStartAfterTime(cal.getTime());

        cal.add(Calendar.HOUR, 1);
        /*Maximum time for the consumption pattern to start*/
        flexOffer.setStartBeforeTime(cal.getTime());
        flexOffer.setOfferedById(id);
        flexOffer.setId(1);

        
        try {
            foa.createFlexOffer(id, flexOffer);
        } catch (FlexOfferException e) {
            System.out.println("Something went wrong!");
        }
    }
/**
     * Example of a method to generate a FlexOffer
     * @param start
     * @param end
     * @return
     */
Example of a method to generate a FlexOffer
@param start
@param end
@return
Example of a method to generate a FlexOffer @param start @param end @return
public void generateFlexOffer() {
        FlexOffer flexOffer = new FlexOffer();
        /*
         * Here we just use static value to populate the slices of the flexoffer
         */
        List<FlexOfferSlice> slices = new ArrayList<FlexOfferSlice>();
        int loadLow[] = new int[] { -500, 1700, -1050, 1100, 500, 1400, 400 };
        int loadHigh[] = new int[] { 500, 1732, -500, 1168, 552, 1471, 453 };
        int sliceDuration = 4;
        for (int i = 0; i < loadLow.length; i++) {
            slices.add(new FlexOfferSlice(sliceDuration, 1, loadLow[i], loadHigh[i]));
        }
        flexOffer.setSlices(slices.toArray(flexOffer.getSlices()));
        /*Need to set some time parameter of the flexoffer*/
        Date ct = new java.util.Date();
        flexOffer.setCreationTime(ct);
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MINUTE, 30);
        cal.add(Calendar.MINUTE, 1);
        /*Time before aggregator needs to send back acceptance*/
        flexOffer.setAcceptanceBeforeTime(cal.getTime());
        cal.add(Calendar.MINUTE, 1);
        /*Time before aggregator needs to send back schedule*/
        flexOffer.setAssignmentBeforeTime(cal.getTime());
        cal.add(Calendar.MINUTE, 10);
        /*Minimum time at which the consumption pattern can start*/
        flexOffer.setStartAfterTime(cal.getTime());
        cal.add(Calendar.HOUR, 1);
        /*Maximum time for the consumption pattern to start*/
        flexOffer.setStartBeforeTime(cal.getTime());
        flexOffer.setOfferedById(id);
        flexOffer.setId(1);
        try {
            foa.createFlexOffer(id, flexOffer);
        } catch (FlexOfferException e) {
            System.out.println("Something went wrong!");
        }
    }
public void generateFlexOffer ( ) { FlexOffer flexOffer = new FlexOffer ( ) ; /*
         * Here we just use static value to populate the slices of the flexoffer
         */ List < FlexOfferSlice > slices = new ArrayList < FlexOfferSlice > ( ) ; int loadLow [ ] = new int [ ] { - 500 , 1700 , - 1050 , 1100 , 500 , 1400 , 400 } ; int loadHigh [ ] = new int [ ] { 500 , 1732 , - 500 , 1168 , 552 , 1471 , 453 } ; int sliceDuration = 4 ; for ( int i = 0 ; i < loadLow . length ; i ++ ) { slices . add ( new FlexOfferSlice ( sliceDuration , 1 , loadLow [ i ] , loadHigh [ i ] ) ) ; } flexOffer . setSlices ( slices . toArray ( flexOffer . getSlices ( ) ) ) ; /*Need to set some time parameter of the flexoffer*/ Date ct = new java . util . Date ( ) ; flexOffer . setCreationTime ( ct ) ; Calendar cal = Calendar . getInstance ( ) ; cal . add ( Calendar . MINUTE , 30 ) ; cal . add ( Calendar . MINUTE , 1 ) ; /*Time before aggregator needs to send back acceptance*/ flexOffer . setAcceptanceBeforeTime ( cal . getTime ( ) ) ; cal . add ( Calendar . MINUTE , 1 ) ; /*Time before aggregator needs to send back schedule*/ flexOffer . setAssignmentBeforeTime ( cal . getTime ( ) ) ; cal . add ( Calendar . MINUTE , 10 ) ; /*Minimum time at which the consumption pattern can start*/ flexOffer . setStartAfterTime ( cal . getTime ( ) ) ; cal . add ( Calendar . HOUR , 1 ) ; /*Maximum time for the consumption pattern to start*/ flexOffer . setStartBeforeTime ( cal . getTime ( ) ) ; flexOffer . setOfferedById ( id ) ; flexOffer . setId ( 1 ) ; try { foa . createFlexOffer ( id , flexOffer ) ; } catch ( FlexOfferException e ) { System . out . println ( "Something went wrong!" ) ; } }
Example of a method to generate a FlexOffer
 @param start
 @param end
 @return
Example of a method to generate a FlexOffer @param start @param end @return