package net.cobem.grizzly.utils;

import java.util.ArrayList;
import java.util.List;

public class ParameterString {
    private String Pattern = "{%s}";
    private String Text;

    private List<String> History = new ArrayList<String>();

    public ParameterString(String Value) {
        Text = Value;
    }

    public ParameterString(String Value, String Pattern) {
        Text = Value;
        this.Pattern = Pattern;
    }

    public ParameterString append(Object ToFind, Object Replace) {
        String Old = Pattern.replace("%s", ToFind.toString());

        History.add("[" + Old + " => " + Replace + "]");

        Text = Text.replace(Old, Replace.toString());

        return this;
    }

    public List<String> getHistory() {
        return History;
    }

    public String toString() {
        return Text;
    }
}
