/* $Id: SpreadSelectionListGrammarChecker.java 125 2011-03-09 09:49:51Z ohura $ */
package smart_gs.spread_selection;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
//import java.io.*;


public class SpreadSelectionListGrammarChecker {
	String sslDefString = "((0|[1-9][0-9]*|(0|[1-9][0-9]*)\\-[1-9][0-9]*), *)*(0|[1-9][0-9]*|(0|[1-9][0-9]*)\\-[1-9][0-9]*)";
	private Pattern pattern;
	private Matcher matcher;

	public SpreadSelectionListGrammarChecker() {
		 pattern = Pattern.compile(sslDefString);
	}
	
	public boolean checks(String string) {
		matcher = pattern.matcher(string);
		return matcher.matches();
	}
	
//	public static void main (String[] args){
//		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//		String input = "";
//
//		SpreadSelectionListGrammarChecker checker = new SpreadSelectionListGrammarChecker();
//		
//		for (;true;){
//			
//			try {
//		         input = br.readLine();
//		      } catch (IOException ioe) {
//		         System.out.println("IO error trying to read your name!");
//		         System.exit(1);
//		      }
//
//		       System.out.println(checker.checks(input));
//		}
//	}

}
