/**
 * Copyright 2017 University of Victoria
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */
package com.rigiresearch.examgen.model;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.experimental.Accessors;

/**
 * A written examination.
 * @author Miguel Jimenez (miguel@uvic.ca)
 * @date 2017-08-20
 * @version $Id$
 * @since 0.0.1
 */
@Accessors(fluent = true)
@AllArgsConstructor
@Getter
public final class Examination {

    /**
     * The document header.
     */
    private final TextSegment header;

    /**
     * This examination's title.
     */
    private final TextSegment title;

    /**
     * Fields printed below the document header. The value is optional.
     * <p>
     * E.g., Name, Student Number, Grade, Lab Section: 08
     */
    private final Map<String, String> fields;

    /**
     * This examination's set of questions.
     */
    private final List<Question> questions;

    /**
     * Scramble this exam.
     * @param seed the seed for the random number generator
     * @return a scrambled version of this exam
     */
    public Examination scrambled(final long seed) {
        final List<Question> scrambledQuestions = this.questions.stream()
            .map(question -> question.scrambled(seed))
            .collect(Collectors.toList());
        Collections.shuffle(
            scrambledQuestions,
            new Random(seed)
        );
        return new Examination(
            this.header,
            this.title,
            this.fields,
            scrambledQuestions
        );
    }

}

@@ -1629,80 +1629,548 @@
   * 
-The document header.%0A     */%0A    private final TextSegment header;%0A%0A
+Parameters regarding this exam.%0A     * @author Miguel Jimenez (miguel@uvic.ca)%0A     * @date 2017-08-21%0A     * @version $Id$%0A     * @since 0.0.1%0A     */%0A    public enum Parameter %7B%0A        /**%0A         * The class to which this exam belongs.%0A         */%0A        CLASS,%0A%0A        /**%0A         * The expected date in which this exam takes place.%0A         */%0A        DATE,%0A%0A        /**%0A         * The specific class section, if any.%0A         */%0A        SECTION,%0A%0A        /**%0A         * The corresponding term.%0A         */%0A        TERM,%0A%0A  
     
+  
 /**%0A
@@ -2174,34 +2174,120 @@
 **%0A     
+   
+ 
 * Th
+e time allocated to this exam.%0A         */%0A        TIME_LIMIT,%0A%0A        /**%0A         * Th
 is exam
-ination
 's title
@@ -2297,197 +2297,710 @@
     
+    
 */%0A    
-private final TextSegment title;%0A%0A    /**%0A     * Fields printed below the document header. The value is optional.%0A     * %3Cp%3E%0A     * E.g., Name, Student Number, Grade, Lab Section: 08
+    TITLE,%0A    %7D%0A%0A    /**%0A     * Optional fields regarding the student's information.%0A     * @author Miguel Jimenez (miguel@uvic.ca)%0A     * @date 2017-08-21%0A     * @version $Id$%0A     * @since 0.0.1%0A     */%0A    public enum Field %7B%0A        /**%0A         * The assigned grade.%0A         */%0A        GRADE,%0A%0A        /**%0A         * The student identification number.%0A         */%0A        STUDENT_ID,%0A%0A        /**%0A         * The student name.%0A         */%0A        STUDENT_NAME,%0A    %7D%0A%0A    /**%0A     * Parameters composing the document header. Values are expected.%0A     */%0A    private final Map%3CParameter, String%3E parameters;%0A%0A    /**%0A     * Fields printed below the document header. Values are optional.
 %0A   
@@ -3026,22 +3026,21 @@
 nal Map%3C
-String
+Field
 , String
@@ -3684,38 +3684,18 @@
 his.
-header,%0A            this.title
+parameters
 ,%0A  

Update parameterization fields