/**
 * 
 */
package mathsquared.resultswizard2;

import java.util.Arrays;
import java.util.Map;

/**
 * Represents one of several possible messages sent between the GUI and display units of the application.
 * 
 * <p>
 * An instance of this enum should be sent with all messages between these two components specifying the details of the message.
 * </p>
 * 
 * @author MathSquared
 * 
 */
@SuppressWarnings("rawtypes")
public enum Message {
    POISON(), ADD(Slide[].class, String.class), REMOVE(String.class), RETR_SLIDES(), RESP_SLIDES(String.class, Slide[].class, true), TICKER(String.class), RETR_TICKER(), RESP_TICKER(String.class);

    private Class[] types;
    private Class mappedKey;
    private Class mappedValue;

    /**
     * Constructs a Message representing a message that should be sent with parameters of the given type.
     * 
     * @param types the parameters of the types that should be sent
     */
    private Message (Class... types) {
        this.types = types;
    }

    /**
     * Constructs a Message representing a message that should be sent with a Map between two types as well as parameters of several other types.
     * 
     * <p>
     * This constructor sets the list of types as if calling {@link #Message(Class...)} with {@link Map}<code>.class</code> prepended to the argument list.
     * </p>
     * 
     * @param mappedKey the key that should be used in the Map
     * @param mappedValue the value that should be used in the Map
     * @param rando unused
     * @param types the parameters of the types that should be sent
     */
    private Message (Class mappedKey, Class mappedValue, boolean rando, Class... types) {
        // Prepend Map to the list of types
        Class[] typesPrime = new Class[types.length + 1];
        typesPrime[0] = Map.class;
        System.arraycopy(types, 0, typesPrime, 1, types.length);
        this.types = typesPrime;
        this.mappedKey = mappedKey;
        this.mappedValue = mappedValue;
    }

    /**
     * Returns a list of parameter types for the given message.
     * 
     * @return an array of parameter types
     */
    public Class[] getTypes () {
        return Arrays.copyOf(types, types.length);
    }

    /**
     * Returns the key that should be used in a Map.
     * 
     * @return the key for the map, or null if none is specified
     */
    public Class getMappedKey () {
        return mappedKey;
    }

    /**
     * Returns the value that should be used in a Map.
     * 
     * @return the value for the map, or null if none is specified
     */
    public Class getMappedValue () {
        return mappedValue;
    }
}

@@ -46,55 +46,8 @@
 2;%0A%0A
-import java.util.Arrays;%0Aimport java.util.Map;%0A
 %0A/**
@@ -340,38 +340,8 @@
  */%0A
-@SuppressWarnings(%22rawtypes%22)%0A
 publ
@@ -372,66 +372,21 @@
 ISON
-()
 , ADD
-(Slide%5B%5D.class, String.class), REMOVE(String.class)
+, REMOVE
 , RE
@@ -394,18 +394,16 @@
 R_SLIDES
-()
 , RESP_S
@@ -411,65 +411,16 @@
 IDES
-(String.class, Slide%5B%5D.class, true), TICKER(String.class)
+, TICKER
 , RE
@@ -428,18 +428,16 @@
 R_TICKER
-()
 , RESP_T
@@ -445,2022 +445,8 @@
 CKER
-(String.class);%0A%0A    private Class%5B%5D types;%0A    private Class mappedKey;%0A    private Class mappedValue;%0A%0A    /**%0A     * Constructs a Message representing a message that should be sent with parameters of the given type.%0A     * %0A     * @param types the parameters of the types that should be sent%0A     */%0A    private Message (Class... types) %7B%0A        this.types = types;%0A    %7D%0A%0A    /**%0A     * Constructs a Message representing a message that should be sent with a Map between two types as well as parameters of several other types.%0A     * %0A     * %3Cp%3E%0A     * This constructor sets the list of types as if calling %7B@link #Message(Class...)%7D with %7B@link Map%7D%3Ccode%3E.class%3C/code%3E prepended to the argument list.%0A     * %3C/p%3E%0A     * %0A     * @param mappedKey the key that should be used in the Map%0A     * @param mappedValue the value that should be used in the Map%0A     * @param rando unused%0A     * @param types the parameters of the types that should be sent%0A     */%0A    private Message (Class mappedKey, Class mappedValue, boolean rando, Class... types) %7B%0A        // Prepend Map to the list of types%0A        Class%5B%5D typesPrime = new Class%5Btypes.length + 1%5D;%0A        typesPrime%5B0%5D = Map.class;%0A        System.arraycopy(types, 0, typesPrime, 1, types.length);%0A        this.types = typesPrime;%0A        this.mappedKey = mappedKey;%0A        this.mappedValue = mappedValue;%0A    %7D%0A%0A    /**%0A     * Returns a list of parameter types for the given message.%0A     * %0A     * @return an array of parameter types%0A     */%0A    public Class%5B%5D getTypes () %7B%0A        return Arrays.copyOf(types, types.length);%0A    %7D%0A%0A    /**%0A     * Returns the key that should be used in a Map.%0A     * %0A     * @return the key for the map, or null if none is specified%0A     */%0A    public Class getMappedKey () %7B%0A        return mappedKey;%0A    %7D%0A%0A    /**%0A     * Returns the value that should be used in a Map.%0A     * %0A     * @return the value for the map, or null if none is specified%0A     */%0A    public Class getMappedValue () %7B%0A        return mappedValue;%0A    %7D
+;
 %0A%7D%0A

Remove constructors and fields from Message instances