All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prompto.problem.ProblemCollector Maven / Gradle / Ivy

The newest version!
package prompto.problem;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


public class ProblemCollector extends ProblemListener {

	List problems = new ArrayList<>();
	Set unique = new HashSet<>();
	
	public void reset() {
		synchronized(problems) {
			problems.clear();
			unique.clear();
		}
	}
	
	@Override
	void addProblem(IProblem problem) {
		synchronized(problems) {
			if(unique.add(problem.toString()))
				problems.add(problem);
		}
			
	}

	public int getCount() {
		synchronized(problems) {
			return problems.size();
		}
	}
	
	public List getProblems() {
		synchronized(problems) {
			return problems;
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy