package de.ugoe.cs.autoquest.plugin.guitar.eventcore;

import de.ugoe.cs.autoquest.IReplayDecorator;
import de.ugoe.cs.autoquest.eventcore.IReplayable;
import de.ugoe.cs.autoquest.plugin.guitar.EFGReplayDecorator;
import de.ugoe.cs.util.StringTools;

/**
 * <p>
 * {@link IReplayable} used to generate test cases for the GUITAR suite.
 * </p>
 * 
 * @author Steffen Herbold
 * @version 1.0
 */
public class GUITARReplayable implements IReplayable {

    /**
     * <p>
     * EventId in the EFG and GUI files.
     * </p>
     */
    String eventId;

    /**
     * <p>
     * Id for object serialization.
     * </p>
     */
    private static final long serialVersionUID = 1L;

    /**
     * <p>
     * Constructor. Creates a new {@link GUITARReplayable}.
     * </p>
     * 
     * @param eventId
     */
    public GUITARReplayable(String eventId) {
        this.eventId = eventId;
    }

    /*
     * (non-Javadoc)
     * 
     * @see de.ugoe.cs.autoquest.eventcore.IReplayable#getReplay()
     */
    @Override
    public String getReplay() {
        StringBuilder replay = new StringBuilder();
        replay.append("<Step>" + StringTools.ENDLINE);
        replay.append("<EventId>" + eventId + "</EventId>" + StringTools.ENDLINE);
        replay.append("<ReachingStep>false</ReachingStep>" + StringTools.ENDLINE);
        replay.append("</Step>" + StringTools.ENDLINE);
        return replay.toString();
    }

    /*
     * (non-Javadoc)
     * 
     * @see de.ugoe.cs.autoquest.eventcore.IReplayable#getDecorator()
     */
    @Override
    public IReplayDecorator getDecorator() {
        return EFGReplayDecorator.getInstance();
    }

}
