org.eclipse.viatra.dse.base

## Class ThreadContext

- java.lang.Object
- - org.eclipse.viatra.dse.base.ThreadContext

- All Implemented Interfaces:
    IDseStrategyContext

      public class ThreadContext
      extends java.lang.Object
      implements IDseStrategyContext

  This class holds all the information that is related to a single processing thread of the DesignSpaceExploration process. For any attributes related to the Design Space Exploration process as a whole, see `GlobalContext`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ThreadContext(GlobalContext globalContext, IStrategy strategy, org.eclipse.emf.common.notify.Notifier model)` Creates a `ThreadContext` and sets it up to be initialized on the given `TransactionalEditingDomain`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `backtrack()`
    `void` | `backtrackUntilLastCommonActivation(java.lang.Object[] trajectory)`
    `void` | `backtrackUntilRoot()`
    `Fitness` | `calculateFitness()`
    `void` | `changeActivationOrdering(ChangeableConflictSet activationOrderingConflictSet)`
    `void` | `changeActivationOrderingBack()`
    `boolean` | `checkGlobalConstraints()`
    `void` | `executeAcitvationId(java.lang.Object activationId)`
    `boolean` | `executeRandomActivationId()`
    `void` | `executeTrajectory(java.lang.Object[] activationIds)`
    `void` | `executeTrajectory(java.lang.Object[] activationIds, int fromIncludedIndex, int toExcludedIndex)`
    `int` | `executeTrajectoryByTrying(java.lang.Object[] activationIds)`
    `int` | `executeTrajectoryByTrying(java.lang.Object[] activationIds, int fromIncludedIndex, int toExcludedIndex)`
    `int` | `executeTrajectoryByTryingWithoutStateCoding(java.lang.Object[] activationIds)`
    `int` | `executeTrajectoryByTryingWithoutStateCoding(java.lang.Object[] activationIds, int fromIncludedIndex, int toExcludedIndex)`
    `void` | `executeTrajectoryWithMinimalBacktrack(java.lang.Object[] trajectory)`
    `void` | `executeTrajectoryWithMinimalBacktrack(java.lang.Object[] trajectory, int toExcludedIndex)`
    `void` | `executeTrajectoryWithMinimalBacktrackWithoutStateCoding(java.lang.Object[] trajectory)`
    `void` | `executeTrajectoryWithMinimalBacktrackWithoutStateCoding(java.lang.Object[] trajectory, int toExcludedIndex)`
    `int` | `executeTrajectoryWithoutStateCoding(java.lang.Object[] activationIds)`
    `int` | `executeTrajectoryWithoutStateCoding(java.lang.Object[] activationIds, int fromIncludedIndex, int toExcludedIndex)`
    `Activation<?>` | `getActivationById(java.lang.Object activationId)`
    `ActivationCodesConflictSet` | `getActivationCodesConflictSet()`
    `DseConflictResolver` | `getConflictResolver()`
    `ConflictSet` | `getConflictSet()`
    `java.util.Collection<java.lang.Object>` | `getCurrentActivationIds()`
    `java.lang.Object` | `getCurrentStateId()`
    `int` | `getDepth()`
    `IDesignSpace` | `getDesignSpace()`
    `DesignSpaceManager` | `getDesignSpaceManager()`
    `org.eclipse.emf.edit.domain.EditingDomain` | `getEditingDomain()`
    `ExplorerThread` | `getExplorerThread()`
    `java.util.List<IGlobalConstraint>` | `getGlobalConstraints()`
    `GlobalContext` | `getGlobalContext()`
    `Fitness` | `getLastFitness()`
    `IObjective[][]` | `getLeveledObjectives()`
    `org.eclipse.emf.common.notify.Notifier` | `getModel()`
    `ObjectiveComparatorHelper` | `getObjectiveComparatorHelper()`
    `java.util.List<IObjective>` | `getObjectives()`
    `ViatraQueryEngine` | `getQueryEngine()`
    `BatchTransformationRule<?,?>` | `getRuleByActivation(Activation<?> activation)`
    `BatchTransformationRule<?,?>` | `getRuleByActivationId(java.lang.Object activationId)`
    `BatchTransformationRule<?,?>` | `getRuleByRuleSpecification(RuleSpecification<?> ruleSpecification)`
    `RuleEngine` | `getRuleEngine()`
    `java.util.Set<BatchTransformationRule<?,?>>` | `getRules()`
    `java.lang.Object` | `getSharedObject()`
    `SolutionStore` | `getSolutionStore()`
    `IStateCoder` | `getStateCoder()`
    `IStrategy` | `getStrategy()`
    `java.util.List<java.lang.Object>` | `getTrajectory()`
    `java.util.List<java.lang.Object>` | `getTrajectoryCopied()`
    `TrajectoryInfo` | `getTrajectoryInfo()`
    `java.lang.Object` | `getTransitionByActivation(Activation<?> activation)`
    `java.util.Collection<java.lang.Object>` | `getUntraversedActivationIds()`
    `void` | `init()` Initializes the `ThreadContext` by initializing the underlying `ViatraQueryEngine` and `RuleEngine`.
    `boolean` | `isCurrentStateAlreadyTraversed()`
    `boolean` | `isCurrentStateInTrajectory()`
    `void` | `newSolution()`
    `void` | `setExplorerThread(ExplorerThread explorerThread)`
    `void` | `setSharedObject(java.lang.Object sharedObject)`
    `void` | `startAllThreads(IStrategyFactory strategyFactory)`
    `boolean` | `tryExecuteAcitvationId(java.lang.Object activationId)`
    `ExplorerThread` | `tryStartNewThread(IStrategy strategy)`
    `ExplorerThread` | `tryStartNewThreadWithoutModelClone(IStrategy strategy)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ThreadContext

          public ThreadContext(GlobalContext globalContext,
                               IStrategy strategy,
                               org.eclipse.emf.common.notify.Notifier model)

      Creates a `ThreadContext` and sets it up to be initialized on the given `TransactionalEditingDomain`
      Parameters:
        `globalContext` -
        `strategyBase` -
        `domain` -
        `trajectoryInfoToClone` -
        `parentGuidance` -

  - ### Method Detail

    - #### getConflictResolver

          public DseConflictResolver getConflictResolver()

    - #### getConflictSet

          public ConflictSet getConflictSet()

    - #### init

          public void init()
                    throws DSEException

      Initializes the `ThreadContext` by initializing the underlying `ViatraQueryEngine` and `RuleEngine`. `Guidance` initialization is also happening within this method.
      Specified by:
        `init` in interface `IDseStrategyContext`
      Throws:
        `ViatraQueryException`
        `DSEException`

    - #### calculateFitness

          public Fitness calculateFitness()

      Specified by:
        `calculateFitness` in interface `IDseStrategyContext`

    - #### checkGlobalConstraints

          public boolean checkGlobalConstraints()

      Specified by:
        `checkGlobalConstraints` in interface `IDseStrategyContext`

    - #### getRuleEngine

          public RuleEngine getRuleEngine()

      Specified by:
        `getRuleEngine` in interface `IDseStrategyContext`

    - #### getGlobalContext

          public GlobalContext getGlobalContext()

      Specified by:
        `getGlobalContext` in interface `IDseStrategyContext`

    - #### getDesignSpaceManager

          public DesignSpaceManager getDesignSpaceManager()

      Specified by:
        `getDesignSpaceManager` in interface `IDseStrategyContext`

    - #### getEditingDomain

          public org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()

      Specified by:
        `getEditingDomain` in interface `IDseStrategyContext`

    - #### getModel

          public org.eclipse.emf.common.notify.Notifier getModel()

      Specified by:
        `getModel` in interface `IDseStrategyContext`

    - #### getQueryEngine

          public ViatraQueryEngine getQueryEngine()

      Specified by:
        `getQueryEngine` in interface `IDseStrategyContext`

    - #### getStrategy

          public IStrategy getStrategy()

      Specified by:
        `getStrategy` in interface `IDseStrategyContext`

    - #### getExplorerThread

          public ExplorerThread getExplorerThread()

      Specified by:
        `getExplorerThread` in interface `IDseStrategyContext`

    - #### setExplorerThread

          public void setExplorerThread(ExplorerThread explorerThread)

    - #### getLastFitness

          public Fitness getLastFitness()

      Specified by:
        `getLastFitness` in interface `IDseStrategyContext`

    - #### getObjectiveComparatorHelper

          public ObjectiveComparatorHelper getObjectiveComparatorHelper()

      Specified by:
        `getObjectiveComparatorHelper` in interface `IDseStrategyContext`

    - #### getLeveledObjectives

          public IObjective[][] getLeveledObjectives()

      Specified by:
        `getLeveledObjectives` in interface `IDseStrategyContext`

    - #### getObjectives

          public java.util.List<IObjective> getObjectives()

      Specified by:
        `getObjectives` in interface `IDseStrategyContext`

    - #### getGlobalConstraints

          public java.util.List<IGlobalConstraint> getGlobalConstraints()

      Specified by:
        `getGlobalConstraints` in interface `IDseStrategyContext`

    - #### getSolutionStore

          public SolutionStore getSolutionStore()

      Specified by:
        `getSolutionStore` in interface `IDseStrategyContext`

    - #### newSolution

          public void newSolution()

      Specified by:
        `newSolution` in interface `IDseStrategyContext`

    - #### getSharedObject

          public java.lang.Object getSharedObject()

      Specified by:
        `getSharedObject` in interface `IDseStrategyContext`

    - #### setSharedObject

          public void setSharedObject(java.lang.Object sharedObject)

      Specified by:
        `setSharedObject` in interface `IDseStrategyContext`

    - #### getRules

          public java.util.Set<BatchTransformationRule<?,?>> getRules()

      Specified by:
        `getRules` in interface `IDseStrategyContext`

    - #### getRuleByRuleSpecification

          public BatchTransformationRule<?,?> getRuleByRuleSpecification(RuleSpecification<?> ruleSpecification)

      Specified by:
        `getRuleByRuleSpecification` in interface `IDseStrategyContext`

    - #### tryStartNewThread

          public ExplorerThread tryStartNewThread(IStrategy strategy)

      Specified by:
        `tryStartNewThread` in interface `IDseStrategyContext`

    - #### tryStartNewThreadWithoutModelClone

          public ExplorerThread tryStartNewThreadWithoutModelClone(IStrategy strategy)

      Specified by:
        `tryStartNewThreadWithoutModelClone` in interface `IDseStrategyContext`

    - #### startAllThreads

          public void startAllThreads(IStrategyFactory strategyFactory)

      Specified by:
        `startAllThreads` in interface `IDseStrategyContext`

    - #### getStateCoder

          public IStateCoder getStateCoder()

      Specified by:
        `getStateCoder` in interface `IDseStrategyContext`

    - #### getDesignSpace

          public IDesignSpace getDesignSpace()

      Specified by:
        `getDesignSpace` in interface `IDseStrategyContext`

    - #### getTrajectoryInfo

          public TrajectoryInfo getTrajectoryInfo()

      Specified by:
        `getTrajectoryInfo` in interface `IDseStrategyContext`

    - #### getTrajectory

          public java.util.List<java.lang.Object> getTrajectory()

      Specified by:
        `getTrajectory` in interface `IDseStrategyContext`

    - #### getTrajectoryCopied

          public java.util.List<java.lang.Object> getTrajectoryCopied()

      Specified by:
        `getTrajectoryCopied` in interface `IDseStrategyContext`

    - #### getDepth

          public int getDepth()

      Specified by:
        `getDepth` in interface `IDseStrategyContext`

    - #### getCurrentStateId

          public java.lang.Object getCurrentStateId()

      Specified by:
        `getCurrentStateId` in interface `IDseStrategyContext`

    - #### getTransitionByActivation

          public java.lang.Object getTransitionByActivation(Activation<?> activation)

      Specified by:
        `getTransitionByActivation` in interface `IDseStrategyContext`

    - #### getActivationById

          public Activation<?> getActivationById(java.lang.Object activationId)

      Specified by:
        `getActivationById` in interface `IDseStrategyContext`

    - #### getRuleByActivation

          public BatchTransformationRule<?,?> getRuleByActivation(Activation<?> activation)

      Specified by:
        `getRuleByActivation` in interface `IDseStrategyContext`

    - #### getRuleByActivationId

          public BatchTransformationRule<?,?> getRuleByActivationId(java.lang.Object activationId)

      Specified by:
        `getRuleByActivationId` in interface `IDseStrategyContext`

    - #### getCurrentActivationIds

          public java.util.Collection<java.lang.Object> getCurrentActivationIds()

      Specified by:
        `getCurrentActivationIds` in interface `IDseStrategyContext`

    - #### getUntraversedActivationIds

          public java.util.Collection<java.lang.Object> getUntraversedActivationIds()

      Specified by:
        `getUntraversedActivationIds` in interface `IDseStrategyContext`

    - #### executeAcitvationId

          public void executeAcitvationId(java.lang.Object activationId)

      Specified by:
        `executeAcitvationId` in interface `IDseStrategyContext`

    - #### tryExecuteAcitvationId

          public boolean tryExecuteAcitvationId(java.lang.Object activationId)

      Specified by:
        `tryExecuteAcitvationId` in interface `IDseStrategyContext`

    - #### executeRandomActivationId

          public boolean executeRandomActivationId()

      Specified by:
        `executeRandomActivationId` in interface `IDseStrategyContext`

    - #### executeTrajectory

          public void executeTrajectory(java.lang.Object[] activationIds)

      Specified by:
        `executeTrajectory` in interface `IDseStrategyContext`

    - #### executeTrajectory

          public void executeTrajectory(java.lang.Object[] activationIds,
                                        int fromIncludedIndex,
                                        int toExcludedIndex)

      Specified by:
        `executeTrajectory` in interface `IDseStrategyContext`

    - #### executeTrajectoryByTrying

          public int executeTrajectoryByTrying(java.lang.Object[] activationIds)

      Specified by:
        `executeTrajectoryByTrying` in interface `IDseStrategyContext`

    - #### executeTrajectoryByTrying

          public int executeTrajectoryByTrying(java.lang.Object[] activationIds,
                                               int fromIncludedIndex,
                                               int toExcludedIndex)

      Specified by:
        `executeTrajectoryByTrying` in interface `IDseStrategyContext`

    - #### executeTrajectoryWithoutStateCoding

          public int executeTrajectoryWithoutStateCoding(java.lang.Object[] activationIds)

      Specified by:
        `executeTrajectoryWithoutStateCoding` in interface `IDseStrategyContext`

    - #### executeTrajectoryWithoutStateCoding

          public int executeTrajectoryWithoutStateCoding(java.lang.Object[] activationIds,
                                                         int fromIncludedIndex,
                                                         int toExcludedIndex)

      Specified by:
        `executeTrajectoryWithoutStateCoding` in interface `IDseStrategyContext`

    - #### executeTrajectoryByTryingWithoutStateCoding

          public int executeTrajectoryByTryingWithoutStateCoding(java.lang.Object[] activationIds)

      Specified by:
        `executeTrajectoryByTryingWithoutStateCoding` in interface `IDseStrategyContext`

    - #### executeTrajectoryByTryingWithoutStateCoding

          public int executeTrajectoryByTryingWithoutStateCoding(java.lang.Object[] activationIds,
                                                                 int fromIncludedIndex,
                                                                 int toExcludedIndex)

      Specified by:
        `executeTrajectoryByTryingWithoutStateCoding` in interface `IDseStrategyContext`

    - #### executeTrajectoryWithMinimalBacktrack

          public void executeTrajectoryWithMinimalBacktrack(java.lang.Object[] trajectory)

      Specified by:
        `executeTrajectoryWithMinimalBacktrack` in interface `IDseStrategyContext`

    - #### executeTrajectoryWithMinimalBacktrack

          public void executeTrajectoryWithMinimalBacktrack(java.lang.Object[] trajectory,
                                                            int toExcludedIndex)

      Specified by:
        `executeTrajectoryWithMinimalBacktrack` in interface `IDseStrategyContext`

    - #### executeTrajectoryWithMinimalBacktrackWithoutStateCoding

          public void executeTrajectoryWithMinimalBacktrackWithoutStateCoding(java.lang.Object[] trajectory)

      Specified by:
        `executeTrajectoryWithMinimalBacktrackWithoutStateCoding` in interface `IDseStrategyContext`

    - #### executeTrajectoryWithMinimalBacktrackWithoutStateCoding

          public void executeTrajectoryWithMinimalBacktrackWithoutStateCoding(java.lang.Object[] trajectory,
                                                                              int toExcludedIndex)

      Specified by:
        `executeTrajectoryWithMinimalBacktrackWithoutStateCoding` in interface `IDseStrategyContext`

    - #### backtrack

          public boolean backtrack()

      Specified by:
        `backtrack` in interface `IDseStrategyContext`

    - #### backtrackUntilLastCommonActivation

          public void backtrackUntilLastCommonActivation(java.lang.Object[] trajectory)

      Specified by:
        `backtrackUntilLastCommonActivation` in interface `IDseStrategyContext`

    - #### backtrackUntilRoot

          public void backtrackUntilRoot()

      Specified by:
        `backtrackUntilRoot` in interface `IDseStrategyContext`

    - #### isCurrentStateAlreadyTraversed

          public boolean isCurrentStateAlreadyTraversed()

      Specified by:
        `isCurrentStateAlreadyTraversed` in interface `IDseStrategyContext`

    - #### isCurrentStateInTrajectory

          public boolean isCurrentStateInTrajectory()

      Specified by:
        `isCurrentStateInTrajectory` in interface `IDseStrategyContext`

    - #### getActivationCodesConflictSet

          public ActivationCodesConflictSet getActivationCodesConflictSet()

    - #### changeActivationOrdering

          public void changeActivationOrdering(ChangeableConflictSet activationOrderingConflictSet)

    - #### changeActivationOrderingBack

          public void changeActivationOrderingBack()