org.eclipse.ocl.examples.impactanalyzer.instanceScope.unusedEvaluation
Class UnusedEvaluationRequestSet

java.lang.Object
  extended by org.eclipse.ocl.examples.impactanalyzer.instanceScope.unusedEvaluation.UnusedEvaluationRequestSet

public class UnusedEvaluationRequestSet
extends java.lang.Object


Nested Class Summary
static class UnusedEvaluationRequestSet.UnusedEvaluationResult
          If the result says that unused was proven, there won't be a new request set delivered.
 
Method Summary
 UnusedEvaluationRequestSet createReducedSet(java.util.Set<Variable> variablesThatLeaveOrEnterScope, UnusedEvaluationRequestFactory unusedEvaluationRequestFactory)
          Computes a new set of UnusedEvaluationRequests by copying all those requests not keyed by a variable that entered or left scope.
 boolean equals(java.lang.Object obj)
           
static UnusedEvaluationRequestSet.UnusedEvaluationResult evaluate(java.util.Collection<UnusedEvaluationRequest> requestsToEvaluate, OppositeEndFinder oppositeEndFinder, TracebackCache tracebackCache, OCLFactory oclFactory)
          Evaluates the requestsToEvaluate.
 int hashCode()
           
 UnusedEvaluationRequestSet merge(UnusedEvaluationRequestSet other)
          Produces a new instance of this class whose requests map holds the combined sets of UnusedEvaluationRequests from this and the other set.
 UnusedEvaluationRequestSet.UnusedEvaluationResult setVariable(Variable variable, org.eclipse.emf.ecore.EObject value, OppositeEndFinder oppositeEndFinder, TracebackCache tracebackCache, OCLFactory oclFactory)
          Announces that the value for a variable was inferred.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

createReducedSet

public UnusedEvaluationRequestSet createReducedSet(java.util.Set<Variable> variablesThatLeaveOrEnterScope,
                                                   UnusedEvaluationRequestFactory unusedEvaluationRequestFactory)
Computes a new set of UnusedEvaluationRequests by copying all those requests not keyed by a variable that entered or left scope. Those requests whose unknown variable left or entered scope can't be inferred anymore along this traceback chain. Therefore, we can remove their corresponding requests.

For all remaining requests, we remove the slots for any variable contained in variablesThatLeavOrEnterScope.


setVariable

public UnusedEvaluationRequestSet.UnusedEvaluationResult setVariable(Variable variable,
                                                                     org.eclipse.emf.ecore.EObject value,
                                                                     OppositeEndFinder oppositeEndFinder,
                                                                     TracebackCache tracebackCache,
                                                                     OCLFactory oclFactory)
Announces that the value for a variable was inferred. All contained UnusedEvaluationRequests that have a slot for this variable are cloned and the value inferred is stored in the cloned request. If the variable is the unknown variable for any of the requests managed by this set, the request is re-evaluated. If the request evaluates to false, it is silently removed from the new request set returned. If the request evaluates to true, further evaluation is aborted immediately, and the method just returns the fact that one of the requests evaluated to true. If the request evaluation fails due to an unknown variable, the request is returned in the new request set keyed by the now unknown variable.

Parameters:
oclFactory - TODO
Returns:
a result that tells whether unusedness could be proven and which tells the potentially transformed next UnusedEvaluationRequestSet which may be this unchanged object in case no request had a slot for the variable inferred, or a new set which contains the re-organized and possibly cloned requests.

evaluate

public static UnusedEvaluationRequestSet.UnusedEvaluationResult evaluate(java.util.Collection<UnusedEvaluationRequest> requestsToEvaluate,
                                                                         OppositeEndFinder oppositeEndFinder,
                                                                         TracebackCache tracebackCache,
                                                                         OCLFactory oclFactory)
Evaluates the requestsToEvaluate. If any of them returns true from its UnusedEvaluationRequest.evaluate(OppositeEndFinder, OCLFactory) method, a result will be returned that returns true from its UnusedEvaluationRequestSet.UnusedEvaluationResult.hasProvenUnused() method. Otherwise, that result's method will return false. If any request's evaluation failed for an unknown variable, the request will be added to a new UnusedEvaluationRequestSet which is part of this method's result (see UnusedEvaluationRequestSet.UnusedEvaluationResult.getNewRequestSet()), keyed by the unknown Variable.

Parameters:
requestsToEvaluate - may be null which will immediately cause the result to be a combination of false and a new, empty UnusedEvaluationRequestSet.

merge

public UnusedEvaluationRequestSet merge(UnusedEvaluationRequestSet other)
Produces a new instance of this class whose requests map holds the combined sets of UnusedEvaluationRequests from this and the other set.

Parameters:
other - may be null, which makes the method return this unchanged

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object