org.eclipse.emf.henshin.interpreter.impl
Class UnitApplicationImpl

java.lang.Object
  extended by org.eclipse.emf.henshin.interpreter.impl.AbstractApplicationImpl
      extended by org.eclipse.emf.henshin.interpreter.impl.UnitApplicationImpl
All Implemented Interfaces:
UnitApplication

public class UnitApplicationImpl
extends AbstractApplicationImpl

Default UnitApplication implementation.


Field Summary
protected  Stack<RuleApplication> appliedRules
           
protected  Assignment assignment
           
protected  Assignment resultAssignment
           
protected  Stack<RuleApplication> undoneRules
           
 
Fields inherited from class org.eclipse.emf.henshin.interpreter.impl.AbstractApplicationImpl
engine, graph, unit
 
Constructor Summary
UnitApplicationImpl(Engine engine)
          Default constructor.
UnitApplicationImpl(Engine engine, EGraph graph, Unit unit, Assignment assignment)
          Convenience constructor.
 
Method Summary
protected  UnitApplicationImpl createApplicationFor(Unit subUnit)
           
protected  boolean doExecute(ApplicationMonitor monitor)
           
 boolean execute(ApplicationMonitor monitor)
          Execute this unit application.
protected  boolean executeConditionalUnit(ApplicationMonitor monitor)
           
protected  boolean executeIndependentUnit(ApplicationMonitor monitor)
           
protected  boolean executeIteratedUnit(ApplicationMonitor monitor)
           
protected  boolean executeLoopUnit(ApplicationMonitor monitor)
           
protected  boolean executePriorityUnit(ApplicationMonitor monitor)
           
protected  boolean executeRule(ApplicationMonitor monitor)
           
protected  boolean executeSequentialUnit(ApplicationMonitor monitor)
           
 List<RuleApplication> getAppliedRules()
          Get the applied rules of this unit application.
 Assignment getAssignment()
          Get the parameter assignment to be used.
 Assignment getResultAssignment()
          Get the parameter assignment for the result.
 Object getResultParameterValue(String paramName)
          Get the value assigned to a parameter.
 List<RuleApplication> getUndoneRules()
          Get the undone rules of this unit application.
 boolean redo(ApplicationMonitor monitor)
          Redo this unit application.
 void setAssignment(Assignment assignment)
          Set the parameter assignment to be used.
 void setParameterValue(String paramName, Object value)
          Set the assigned value for a parameter.
 boolean undo(ApplicationMonitor monitor)
          Undo this unit application.
protected  void updateParameterValues(UnitApplicationImpl subUnitApp)
           
 
Methods inherited from class org.eclipse.emf.henshin.interpreter.impl.AbstractApplicationImpl
getEGraph, getUnit, setEGraph, setUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

assignment

protected Assignment assignment

resultAssignment

protected Assignment resultAssignment

appliedRules

protected final Stack<RuleApplication> appliedRules

undoneRules

protected final Stack<RuleApplication> undoneRules
Constructor Detail

UnitApplicationImpl

public UnitApplicationImpl(Engine engine)
Default constructor.

Parameters:
engine - Engine to be used.

UnitApplicationImpl

public UnitApplicationImpl(Engine engine,
                           EGraph graph,
                           Unit unit,
                           Assignment assignment)
Convenience constructor.

Parameters:
engine - Engine to be used.
graph - Target graph.
unit - Unit to be used.
assignment - Assignment.
Method Detail

execute

public boolean execute(ApplicationMonitor monitor)
Description copied from interface: UnitApplication
Execute this unit application.

Parameters:
monitor - The application monitor or null.
Returns:
true if the unit was successfully applied.

doExecute

protected boolean doExecute(ApplicationMonitor monitor)

undo

public boolean undo(ApplicationMonitor monitor)
Description copied from interface: UnitApplication
Undo this unit application. This restores the original model as it was before calling #execute().

Parameters:
monitor - The application monitor or null.
Returns:
true if the unit was successfully undone.

redo

public boolean redo(ApplicationMonitor monitor)
Description copied from interface: UnitApplication
Redo this unit application. This method can be invoked after #undo() has been invoked. The effect is that the unit is executed again.

Parameters:
monitor - The application monitor or null.
Returns:
true if the unit was successfully redone.

executeRule

protected boolean executeRule(ApplicationMonitor monitor)

executeIndependentUnit

protected boolean executeIndependentUnit(ApplicationMonitor monitor)

executeSequentialUnit

protected boolean executeSequentialUnit(ApplicationMonitor monitor)

executeConditionalUnit

protected boolean executeConditionalUnit(ApplicationMonitor monitor)

executePriorityUnit

protected boolean executePriorityUnit(ApplicationMonitor monitor)

executeIteratedUnit

protected boolean executeIteratedUnit(ApplicationMonitor monitor)

executeLoopUnit

protected boolean executeLoopUnit(ApplicationMonitor monitor)

createApplicationFor

protected UnitApplicationImpl createApplicationFor(Unit subUnit)

updateParameterValues

protected void updateParameterValues(UnitApplicationImpl subUnitApp)

getAssignment

public Assignment getAssignment()
Description copied from interface: UnitApplication
Get the parameter assignment to be used.

Returns:
The parameter assignment.

setAssignment

public void setAssignment(Assignment assignment)
Description copied from interface: UnitApplication
Set the parameter assignment to be used.

Parameters:
assignment - The parameter assignment.

getResultAssignment

public Assignment getResultAssignment()
Description copied from interface: UnitApplication
Get the parameter assignment for the result.

Returns:
The result parameter assignment.

getResultParameterValue

public Object getResultParameterValue(String paramName)
Description copied from interface: UnitApplication
Get the value assigned to a parameter. This is a convenience method to directly access the result assignment of this unit. This is possible only if the unit is set and the unit is applied.

Parameters:
paramName - The name of the parameter.
Returns:
The assigned result value or null.

setParameterValue

public void setParameterValue(String paramName,
                              Object value)
Description copied from interface: UnitApplication
Set the assigned value for a parameter. This is a convenience method to directly access the assignment of this unit. This is possible only if the unit is set.

Parameters:
paramName - The name of the parameter.
value - The value to be assigned with the parameter.

getAppliedRules

public List<RuleApplication> getAppliedRules()
Get the applied rules of this unit application.

Returns:
List of applied rules.

getUndoneRules

public List<RuleApplication> getUndoneRules()
Get the undone rules of this unit application.

Returns:
List of undone rules.