Class Message
- java.lang.Object
-
- net.ssehub.easy.basics.messages.Message
-
- net.ssehub.easy.reasoning.core.reasoner.Message
-
- All Implemented Interfaces:
IMessage
public class Message extends Message
Part of theReasoningResultclass, expressing on error/warning of a completeReasoningResult. Takes a series of lists, which shall be consistent in size. Complex textual representations are calculated on demand when requesting the respective information (rather than calculating this without need beforehand in a reasoner).- Author:
- El-Sharkawy, Sizonenko
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMessage.SuggestionTypeDefines supported suggestion types.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Project>conflictingElementProjectsprivate java.util.List<ModelElement>conflictingElementsprivate java.util.List<Message.SuggestionType>conflictingElementSuggestionsprivate java.util.List<IDecisionVariable>constraintVariablesprivate java.util.List<java.lang.Integer>errorClassificationprivate java.util.List<ConstraintSyntaxTree>problemConstraintPartsprivate java.util.List<Constraint>problemConstraintsprivate java.util.List<java.util.Set<IDecisionVariable>>problemVariablesprivate java.util.List<java.util.Set<AbstractVariable>>variablesInConstraints
-
Constructor Summary
Constructors Constructor Description Message(java.lang.String explanation, java.util.List<ModelElement> conflictingElements, Status status)Sole constructor for multiple conflicting elements.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConflictingElementProjects(java.util.List<Project> conflictingElementProjects)Method for adding conflicting element Projects.voidaddConflictingElementSuggestions(java.util.List<Message.SuggestionType> conflictingElementSuggestions)Method for adding conflicting element Suggestions.voidaddConstraintVariables(java.util.List<java.util.Set<AbstractVariable>> variables)Method for adding a list ofAbstractVariables that are involved in each failed constraint.voidaddErrorClassification(java.util.List<java.lang.Integer> errorClassification)Method for adding a list of reasoning error classifiers Null if non.voidaddNamedConstraintVariables(java.util.List<IDecisionVariable> constraintVariables)Method for adding a list of ConstraintVariables of a failed constraint.voidaddProblemConstraintParts(java.util.List<ConstraintSyntaxTree> constraints)Method for adding a list of partialConstraintSyntaxTrees that are involved in each failed constraint.voidaddProblemConstraints(java.util.List<Constraint> constraints)Method for adding a list ofConstraints that are involved in each failed constraint.voidaddProblemVariables(java.util.List<java.util.Set<IDecisionVariable>> variables)Method for adding a list ofIDecisionVariables that are involved in each failed constraint.private java.lang.Stringappend(java.lang.String res, java.lang.String text)Appendstextand a line end tores.static java.util.List<ModelElement>createList(ModelElement element)Creates a list with on element.java.util.List<java.lang.String>getConflictComments()Returns the list of conflicting item comments.java.util.List<java.lang.String>getConflictLabels()Returns the list of conflicting item labels.java.util.List<Project>getConflictProjects()Returns the list of conflicting item Projects.java.util.List<ModelElement>getConflicts()Returns the list of conflicting items.intgetConflictsCount()Returns the number of conflicting elements.java.util.List<java.lang.String>getConflictSuggestions()Returns the list of conflicting item Suggestions.java.util.List<Message.SuggestionType>getConflictSuggestionTypes()Returns the list of conflicting item suggestion types.java.util.List<java.util.Set<AbstractVariable>>getConstraintVariables()Method for returning a list ofAbstractVariables that are involved in each failed constraint.java.util.List<java.lang.Integer>getErrorClassification()Method for returning a list of reasoning error classifiers.java.util.List<IDecisionVariable>getNamedConstraintVariables()Method for returning a list of ConstraintVariables of a failed constraint.java.util.List<ConstraintSyntaxTree>getProblemConstraintParts()Method for returning a list of partialConstraintSyntaxTrees that are involved in each failed constraint.java.util.List<Constraint>getProblemConstraints()Method for returning a list of fullConstraints that are involved in each failed constraint.java.util.List<java.util.Set<IDecisionVariable>>getProblemVariables()Method for returning a list ofIDecisionVariables that are involved in each failed constraint.private static intmin(int v1, int v2, int v3)Returns the minimum of the three given integer values.private static intmin(int v1, int v2, int v3, int v4)Returns the minimum of the four given integer values.private static booleannoResult(java.lang.String result)private java.lang.StringproblemPointsToString(java.util.Set<AbstractVariable> vars)Turns given variables into a problem points description.java.lang.StringtoString()private java.lang.StringtoString(Constraint constraint, IDecisionVariable namedVariable)Turns a constraint into a string representation.private java.lang.StringtoString(ModelElement elt, IDecisionVariable namedVariable)Turns a model element into a string representation.private java.lang.StringtraceToTop(ModelElement element)Method for creating a msg of trace to the top element of constraint or variable that fail in the reasoning.-
Methods inherited from class net.ssehub.easy.basics.messages.Message
containsError, getDescription, getDetailedDescription, getStatus, toString
-
-
-
-
Field Detail
-
conflictingElements
private java.util.List<ModelElement> conflictingElements
-
variablesInConstraints
private java.util.List<java.util.Set<AbstractVariable>> variablesInConstraints
-
problemVariables
private java.util.List<java.util.Set<IDecisionVariable>> problemVariables
-
problemConstraintParts
private java.util.List<ConstraintSyntaxTree> problemConstraintParts
-
problemConstraints
private java.util.List<Constraint> problemConstraints
-
conflictingElementProjects
private java.util.List<Project> conflictingElementProjects
-
conflictingElementSuggestions
private java.util.List<Message.SuggestionType> conflictingElementSuggestions
-
constraintVariables
private java.util.List<IDecisionVariable> constraintVariables
-
errorClassification
private java.util.List<java.lang.Integer> errorClassification
-
-
Constructor Detail
-
Message
public Message(java.lang.String explanation, java.util.List<ModelElement> conflictingElements, Status status)Sole constructor for multiple conflicting elements.- Parameters:
explanation- A textual representation of this messageconflictingElements- A list of model elements which lead to the current message, or nullstatus- The status of this message, e. g. Error or Warning
-
-
Method Detail
-
createList
public static final java.util.List<ModelElement> createList(ModelElement element)
Creates a list with on element.- Parameters:
element- the element to put into the list- Returns:
- the list with
elementas member ifnull != element, null else
-
getConflicts
public java.util.List<ModelElement> getConflicts()
Returns the list of conflicting items.- Returns:
- The list of conflicting items
-
getConflictsCount
public int getConflictsCount()
Returns the number of conflicting elements.- Returns:
- Number of conflicting elements.
-
min
private static int min(int v1, int v2, int v3)Returns the minimum of the three given integer values.- Parameters:
v1- the first valuev2- the second valuev3- the third value- Returns:
- the minimum of the three given integer values
-
min
private static int min(int v1, int v2, int v3, int v4)Returns the minimum of the four given integer values.- Parameters:
v1- the first valuev2- the second valuev3- the third valuev4- the fourth value- Returns:
- the minimum of the four given integer values
-
getConflictLabels
public java.util.List<java.lang.String> getConflictLabels()
Returns the list of conflicting item labels.- Returns:
- The list of conflicting item labels. The number of entries depends on the minimum number of conflicting element suggestions, conflicting elements, constraint variables and variables in constraints.
-
getConflictComments
public java.util.List<java.lang.String> getConflictComments()
Returns the list of conflicting item comments.- Returns:
- The list of conflicting item comments. The number of entries depends on the minimum number of conflicting element suggestions, conflicting elements, and constraint variables.
-
toString
private java.lang.String toString(Constraint constraint, IDecisionVariable namedVariable)
Turns a constraint into a string representation. If a named variable is given, use comment or name instead.- Parameters:
constraint- the constraintnamedVariable- the related named variable (may be null)- Returns:
- the string representation
-
noResult
private static boolean noResult(java.lang.String result)
-
toString
private java.lang.String toString(ModelElement elt, IDecisionVariable namedVariable)
Turns a model element into a string representation. ConsidersDisplayNameProviderandtoString(Constraint, IDecisionVariable).- Parameters:
elt- the element to be turned into a string representationnamedVariable- the related named variable (may be null)- Returns:
- the string representation
-
traceToTop
private java.lang.String traceToTop(ModelElement element)
Method for creating a msg of trace to the top element of constraint or variable that fail in the reasoning.- Parameters:
element- Constraint of Variable.- Returns:
- text text of the trace.
-
addConflictingElementSuggestions
public void addConflictingElementSuggestions(java.util.List<Message.SuggestionType> conflictingElementSuggestions)
Method for adding conflicting element Suggestions.- Parameters:
conflictingElementSuggestions- conflicting element Suggestions.
-
getConflictSuggestionTypes
public java.util.List<Message.SuggestionType> getConflictSuggestionTypes()
Returns the list of conflicting item suggestion types.- Returns:
- The list of conflicting item suggestion types.
-
getConflictSuggestions
public java.util.List<java.lang.String> getConflictSuggestions()
Returns the list of conflicting item Suggestions.- Returns:
- The list of conflicting item Suggestions. The number of entries depends on the minimum number of conflicting element suggestions and variables in constraints.
-
problemPointsToString
private java.lang.String problemPointsToString(java.util.Set<AbstractVariable> vars)
Turns given variables into a problem points description.- Parameters:
vars- the variables- Returns:
- the description
-
addConflictingElementProjects
public void addConflictingElementProjects(java.util.List<Project> conflictingElementProjects)
Method for adding conflicting element Projects.- Parameters:
conflictingElementProjects- conflicting element Projects.
-
getConflictProjects
public java.util.List<Project> getConflictProjects()
Returns the list of conflicting item Projects.- Returns:
- The list of conflicting item Projects.
-
addConstraintVariables
public void addConstraintVariables(java.util.List<java.util.Set<AbstractVariable>> variables)
Method for adding a list ofAbstractVariables that are involved in each failed constraint.- Parameters:
variables- List of variables.
-
getConstraintVariables
public java.util.List<java.util.Set<AbstractVariable>> getConstraintVariables()
Method for returning a list ofAbstractVariables that are involved in each failed constraint.- Returns:
- List of variables.
-
addProblemVariables
public void addProblemVariables(java.util.List<java.util.Set<IDecisionVariable>> variables)
Method for adding a list ofIDecisionVariables that are involved in each failed constraint.- Parameters:
variables- List of variables.
-
getProblemVariables
public java.util.List<java.util.Set<IDecisionVariable>> getProblemVariables()
Method for returning a list ofIDecisionVariables that are involved in each failed constraint.- Returns:
- List of variables.
-
addProblemConstraintParts
public void addProblemConstraintParts(java.util.List<ConstraintSyntaxTree> constraints)
Method for adding a list of partialConstraintSyntaxTrees that are involved in each failed constraint.- Parameters:
constraints- List of constraint trees (elements may be null). The entries in this list must correspond toaddProblemConstraints(List).
-
addProblemConstraints
public void addProblemConstraints(java.util.List<Constraint> constraints)
Method for adding a list ofConstraints that are involved in each failed constraint. The entries in this list must correspond toaddProblemConstraintParts(List).- Parameters:
constraints- List of constraints.
-
getProblemConstraintParts
public java.util.List<ConstraintSyntaxTree> getProblemConstraintParts()
Method for returning a list of partialConstraintSyntaxTrees that are involved in each failed constraint. The result must correspond togetProblemConstraints().- Returns:
- List of constraint syntax trees.
-
getProblemConstraints
public java.util.List<Constraint> getProblemConstraints()
Method for returning a list of fullConstraints that are involved in each failed constraint. The result must correspond togetProblemConstraintParts().- Returns:
- List of constraints.
-
addNamedConstraintVariables
public void addNamedConstraintVariables(java.util.List<IDecisionVariable> constraintVariables)
Method for adding a list of ConstraintVariables of a failed constraint. Null if non.- Parameters:
constraintVariables- ConstraintVariable or null.
-
getNamedConstraintVariables
public java.util.List<IDecisionVariable> getNamedConstraintVariables()
Method for returning a list of ConstraintVariables of a failed constraint. Null if none.- Returns:
- List of ConstraintVariable or null.
-
addErrorClassification
public void addErrorClassification(java.util.List<java.lang.Integer> errorClassification)
Method for adding a list of reasoning error classifiers Null if non.- Parameters:
errorClassification- defined error codes or null.
-
getErrorClassification
public java.util.List<java.lang.Integer> getErrorClassification()
Method for returning a list of reasoning error classifiers. Null if none.- Returns:
- List of error codes or null.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
append
private java.lang.String append(java.lang.String res, java.lang.String text)Appendstextand a line end tores.- Parameters:
res- the text to append totext- the text to append- Returns:
- the combined text
-
-