Package gov.nasa.pds.tools.validate
Class ProblemContainer
java.lang.Object
gov.nasa.pds.tools.validate.ProblemContainer
- All Implemented Interfaces:
ProblemHandler,ProblemListener
public class ProblemContainer extends Object implements ProblemListener
Implements a problem listener that accumulates problems in a list.
-
Constructor Summary
Constructors Constructor Description ProblemContainer() -
Method Summary
Modifier and Type Method Description voidaddLocation(String location)Adds a location to the listener.voidaddProblem(ValidationProblem problem)Indicates another problem during the validation.voidclear()Clears all problems.intgetErrorCount()Gets the number of error problems encountered.intgetInfoCount()Gets the number of informational problems encountered.intgetProblemCount()Gets the number of problems reported.List<ValidationProblem>getProblems()Gets the problems encountered.Collection<ValidationProblem>getProblemsForLocation(String location, boolean includeChildren)Gets a collection of problems for a given location.ExceptionTypegetSeverity(String location, boolean includeChildren)Gets the maximum severity of problems related to a location.intgetWarningCount()Gets the number of warning problems encountered.BooleanhasError()BooleanhasFatal()BooleanhasInfo()booleanhasProblems(String location, boolean includeChildren)Tests whether a target has had problems reported.BooleanhasWarning()
-
Constructor Details
-
ProblemContainer
public ProblemContainer()
-
-
Method Details
-
addProblem
Description copied from interface:ProblemHandlerIndicates another problem during the validation.- Specified by:
addProblemin interfaceProblemHandler- Parameters:
problem- the validation problem encountered
-
addLocation
Description copied from interface:ProblemListenerAdds a location to the listener.- Specified by:
addLocationin interfaceProblemListener- Parameters:
location- the location of the label being validated.
-
getProblems
Gets the problems encountered.- Returns:
- the problems
-
getProblemCount
public int getProblemCount()Gets the number of problems reported.- Returns:
- the count of problems
-
clear
public void clear()Clears all problems. -
getErrorCount
public int getErrorCount()Description copied from interface:ProblemListenerGets the number of error problems encountered.- Specified by:
getErrorCountin interfaceProblemListener- Returns:
- the error count
-
hasError
-
hasFatal
-
getWarningCount
public int getWarningCount()Description copied from interface:ProblemListenerGets the number of warning problems encountered.- Specified by:
getWarningCountin interfaceProblemListener- Returns:
- the warning count
-
hasWarning
-
getInfoCount
public int getInfoCount()Description copied from interface:ProblemListenerGets the number of informational problems encountered.- Specified by:
getInfoCountin interfaceProblemListener- Returns:
- the info count
-
hasInfo
-
getProblemsForLocation
public Collection<ValidationProblem> getProblemsForLocation(String location, boolean includeChildren)Description copied from interface:ProblemListenerGets a collection of problems for a given location.- Specified by:
getProblemsForLocationin interfaceProblemListener- Parameters:
location- the target locationincludeChildren- true, if problems for child locations should be included- Returns:
- a collection of problems
-
hasProblems
Description copied from interface:ProblemListenerTests whether a target has had problems reported.- Specified by:
hasProblemsin interfaceProblemListener- Parameters:
location- the target locationincludeChildren- true, if problems for child locations should be included- Returns:
- true, if problems have been reported
-
getSeverity
Description copied from interface:ProblemListenerGets the maximum severity of problems related to a location.- Specified by:
getSeverityin interfaceProblemListener- Parameters:
location- the target locationincludeChildren- true, if problems in children of the target should be included- Returns:
- the maximum problem severity
-