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

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

public class RuleApplicationImpl
extends AbstractApplicationImpl
implements RuleApplication

Default RuleApplication implementation.


Field Summary
protected  Change change
           
protected  Match completeMatch
           
protected  boolean isCompleteMatchDerived
           
protected  boolean isExecuted
           
protected  boolean isUndone
           
protected  Match partialMatch
           
protected  Match resultMatch
           
 
Fields inherited from class org.eclipse.emf.henshin.interpreter.impl.AbstractApplicationImpl
engine, graph, unit
 
Constructor Summary
RuleApplicationImpl(Engine engine)
          Default constructor.
RuleApplicationImpl(Engine engine, EGraph graph, Rule rule, Assignment partialMatch)
          Default constructor.
 
Method Summary
 boolean execute(ApplicationMonitor monitor)
          Execute this unit application.
 Assignment getAssignment()
          Get the parameter assignment to be used.
 Match getCompleteMatch()
          Get the complete match to be used.
 Match getPartialMatch()
          Get the partial match to be used.
 Assignment getResultAssignment()
          Get the parameter assignment for the result.
 Match getResultMatch()
          Get the match for the result of the transformation (after the unit has been applied).
 Object getResultParameterValue(String paramName)
          Get the value assigned to a parameter.
 Rule getRule()
          Get the rule to be applied.
 boolean redo(ApplicationMonitor monitor)
          Redo this unit application.
 void setAssignment(Assignment assignment)
          Set the parameter assignment to be used.
 void setCompleteMatch(Match completeMatch)
          Set the complete match to be used.
 void setParameterValue(String paramName, Object value)
          Set the assigned value for a parameter.
 void setPartialMatch(Match partialMatch)
          Set the partial match to be used.
 void setRule(Rule rule)
          Set the rule to be applied.
 void setUnit(Unit unit)
          Set the unit to be applied.
 boolean undo(ApplicationMonitor monitor)
          Undo this unit application.
 
Methods inherited from class org.eclipse.emf.henshin.interpreter.impl.AbstractApplicationImpl
getEGraph, getUnit, setEGraph, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.henshin.interpreter.UnitApplication
getEGraph, getUnit, setEGraph
 

Field Detail

partialMatch

protected Match partialMatch

completeMatch

protected Match completeMatch

resultMatch

protected Match resultMatch

isCompleteMatchDerived

protected boolean isCompleteMatchDerived

change

protected Change change

isExecuted

protected boolean isExecuted

isUndone

protected boolean isUndone
Constructor Detail

RuleApplicationImpl

public RuleApplicationImpl(Engine engine)
Default constructor.

Parameters:
engine - Engine to be used.

RuleApplicationImpl

public RuleApplicationImpl(Engine engine,
                           EGraph graph,
                           Rule rule,
                           Assignment partialMatch)
Default constructor.

Parameters:
engine - Engine to be used.
graph - Object graph to be transformed.
rule - Rule to be applied.
partialMatch - Partial match or assignment.
Method Detail

execute

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

Specified by:
execute in interface UnitApplication
Parameters:
monitor - The application monitor or null.
Returns:
true if the unit was successfully applied.

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().

Specified by:
undo in interface UnitApplication
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.

Specified by:
redo in interface UnitApplication
Parameters:
monitor - The application monitor or null.
Returns:
true if the unit was successfully redone.

getRule

public Rule getRule()
Description copied from interface: RuleApplication
Get the rule to be applied.

Specified by:
getRule in interface RuleApplication
Returns:
The rule to be applied.

setRule

public void setRule(Rule rule)
Description copied from interface: RuleApplication
Set the rule to be applied.

Specified by:
setRule in interface RuleApplication
Parameters:
rule - The rule to be applied.

setUnit

public void setUnit(Unit unit)
Description copied from interface: UnitApplication
Set the unit to be applied.

Specified by:
setUnit in interface UnitApplication
Overrides:
setUnit in class AbstractApplicationImpl
Parameters:
unit - The transformation unit.

getAssignment

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

Specified by:
getAssignment in interface UnitApplication
Returns:
The parameter assignment.

setAssignment

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

Specified by:
setAssignment in interface UnitApplication
Parameters:
assignment - The 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.

Specified by:
getResultParameterValue in interface UnitApplication
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.

Specified by:
setParameterValue in interface UnitApplication
Parameters:
paramName - The name of the parameter.
value - The value to be assigned with the parameter.

getPartialMatch

public Match getPartialMatch()
Description copied from interface: RuleApplication
Get the partial match to be used.

Specified by:
getPartialMatch in interface RuleApplication
Returns:
The partial match.

setPartialMatch

public void setPartialMatch(Match partialMatch)
Description copied from interface: RuleApplication
Set the partial match to be used.

Specified by:
setPartialMatch in interface RuleApplication
Parameters:
partialMatch - The partial match (can be null).

getCompleteMatch

public Match getCompleteMatch()
Description copied from interface: RuleApplication
Get the complete match to be used.

Specified by:
getCompleteMatch in interface RuleApplication
Returns:
The complete match.

setCompleteMatch

public void setCompleteMatch(Match completeMatch)
Description copied from interface: RuleApplication
Set the complete match to be used. If it is set to null, the complete match will be derived from the partial match.

Specified by:
setCompleteMatch in interface RuleApplication
Parameters:
completeMatch - The complete match (can be null).

getResultMatch

public Match getResultMatch()
Description copied from interface: RuleApplication
Get the match for the result of the transformation (after the unit has been applied).

Specified by:
getResultMatch in interface RuleApplication
Returns:
The match for the result.

getResultAssignment

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

Specified by:
getResultAssignment in interface UnitApplication
Returns:
The result parameter assignment.