package vermilion;

/**
 * Stores a pattern command in the document. This class is used at runtime and
 * saved indirectly as part of a PatternNode object.
 */
public class ParameterPattern extends ParameterBase
{
    /**
     * The stored command value for this command.
     */
    public String value;

    public ParameterPattern(String name, String command)
    {
        super(name, PARAMETER_TYPE_PATTERN, true);
        value = command;
    }

    /**
     * The serialisation type for this object is COMMAND.
     */
    @Override
    public String getType() { return "COMMAND"; }

    /**
     * The current serialisation version for this object is 1.
     */
    @Override
    public int getVersion() { return 1; }

    /**
     * Saves this CommandNode to the document.
     */
    @Override
    public String saveImpl()
    {
        return value;
    }

    /**
     * Loads a CommandNode from the document.
     */
    @Override
    public UsefulFileObject loadImpl(String str, int version)
    {
        ParameterPattern node = new ParameterPattern("", str);

        return node;
    }

    @Override
    public void copyValue(ParameterBase source)
    {
        value = ((ParameterPattern) source).value;
    }
}