Interface IViolation
-
- All Known Implementing Classes:
Violation
public interface IViolation
A violation is set of model elements in an instance model that satisfy the specification of a constraint. E.g. for the above constraint, a violation is a port P which is terminated and a port connection PC with "PC.end = P".Each violation has:
- a corresponding constraint
- a key (one or more model elements that are relevant for the violation (e.g. the port and the port connection in the example)
- a formatted message.
The violation should provide capabilities for
- registering listeners for notifications on life cycle events, e.g. a change in the message.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addListener(ViolationListener listener)
Adds the given listener to the list of listeners to be notified on specific events regarding the violation.IConstraint
getConstraint()
Returns the constraint for which the violation appeared.java.util.Set<IEntry>
getEntries()
Returns the entries for each pattern match witch corresponds to the violation.java.util.Map<java.lang.String,java.lang.Object>
getKeyObjects()
Returns the key objects Map of the violation, which serves as a unique key of the violation.java.util.Collection<ViolationListener>
getListeners()
Returns the listeners registered for the violation.java.lang.String
getMessage()
Returns the message of the violation generated from the format message of the constraint specification and the key objects.java.util.Set<java.lang.Object>
getValuesOfProperty(java.lang.String propertyName)
Returns all the values from the violation's entries for the given property.boolean
removeListener(ViolationListener listener)
Removes the given listener from the list of listeners to be notified on specific events regarding the violation.
-
-
-
Method Detail
-
getConstraint
IConstraint getConstraint()
Returns the constraint for which the violation appeared.- Returns:
- The constraint.
-
getMessage
java.lang.String getMessage()
Returns the message of the violation generated from the format message of the constraint specification and the key objects.- Returns:
- The message.
-
getKeyObjects
java.util.Map<java.lang.String,java.lang.Object> getKeyObjects()
Returns the key objects Map of the violation, which serves as a unique key of the violation.- Returns:
- The key objects Map, containing the parameters names and values as key value pairs.
-
getEntries
java.util.Set<IEntry> getEntries()
Returns the entries for each pattern match witch corresponds to the violation.- Returns:
- The Set of entries, each representing a pattern match for the violation.
-
getValuesOfProperty
java.util.Set<java.lang.Object> getValuesOfProperty(java.lang.String propertyName)
Returns all the values from the violation's entries for the given property.- Parameters:
propertyName
- The property's name for which the values should be returned.- Returns:
- The Set of values for the requested property.
-
getListeners
java.util.Collection<ViolationListener> getListeners()
Returns the listeners registered for the violation.- Returns:
- The Collection of listeners registered for the violation.
-
addListener
boolean addListener(ViolationListener listener)
Adds the given listener to the list of listeners to be notified on specific events regarding the violation.- Parameters:
listener
- The listener to be registered.
-
removeListener
boolean removeListener(ViolationListener listener)
Removes the given listener from the list of listeners to be notified on specific events regarding the violation.- Parameters:
listener
- The listener to be deregistered.- Returns:
true
if the listener was in fact registered.
-
-