// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
package dyndi.params;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.springframework.stereotype.Component;

@Component
public class ParamSSDFactory implements ParamFactory {
    private static Pattern valueSSD = Pattern.compile("\"(\\S+)\" \\[(\\S+)\\] \\(([\\d.]+)\\)");
    private Matcher m;
    public void init(String allvalues) {
        m = valueSSD.matcher(allvalues);
    }
    public boolean isMatch() {
        return m.matches();
    }
    public Param createParam(String name) {
        return new Param3Value<String, String, Double>(name, m.group(1), m.group(2), Double.parseDouble(m.group(3)));
    }
}
