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

java.lang.Object
  extended by org.eclipse.emf.henshin.interpreter.impl.AssignmentImpl
      extended by org.eclipse.emf.henshin.interpreter.impl.MatchImpl
All Implemented Interfaces:
Assignment, Match

public class MatchImpl
extends AssignmentImpl
implements Match

Default Match implementation.


Field Summary
protected  List<Node> nodes
           
 
Fields inherited from class org.eclipse.emf.henshin.interpreter.impl.AssignmentImpl
isResult, unit, values
 
Constructor Summary
MatchImpl(Assignment assignment, boolean isResultMatch)
          Constructor.
MatchImpl(Rule rule)
          Default constructor.
MatchImpl(Rule rule, boolean isResultMatch)
          Constructor.
 
Method Summary
 boolean equals(Object obj)
           
 List<Match> getMultiMatches(Rule multiRule)
          Get the nested matches for a multi-rule.
 EObject getNodeTarget(Node node)
          Get the match target for a node.
 List<EObject> getNodeTargets()
          Get all node targets of this match.
 Rule getRule()
          Get the rule that this match is used for.
 boolean isComplete()
          Checks if all nodes have a target and all nested matches are also complete.
 boolean isValid()
          Checks whether this match is complete, whether the typing of the matched objects is correct with respect to the node types, and whether all edges are present.
 boolean overlapsWith(Match match)
          Checks whether this match overlaps with another match.
 void setNodeTarget(Node node, EObject target)
          Set the match target for a node.
 void setParameterValue(Parameter param, Object value)
          Set the assigned value for a parameter.
protected  void setUnit(Unit unit)
           
 String toString()
           
protected  String toStringWithIndent(String indent)
           
 
Methods inherited from class org.eclipse.emf.henshin.interpreter.impl.AssignmentImpl
clear, copyParameterValues, getParameterValue, getParameterValues, getUnit, hashCode, isEmpty, isResult, setValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.henshin.interpreter.Assignment
clear, getParameterValue, getParameterValues, getUnit, isEmpty, isResult
 

Field Detail

nodes

protected List<Node> nodes
Constructor Detail

MatchImpl

public MatchImpl(Rule rule)
Default constructor.

Parameters:
rule - Rule to be matched.

MatchImpl

public MatchImpl(Rule rule,
                 boolean isResultMatch)
Constructor.

Parameters:
rule - The rule that this match is used for.
isResultMatch - Determines whether this is a result match.

MatchImpl

public MatchImpl(Assignment assignment,
                 boolean isResultMatch)
Constructor.

Parameters:
assignment - The assignment or match to be copied.
isResultMatch - Determines whether this is a result match.
Method Detail

setUnit

protected void setUnit(Unit unit)
Overrides:
setUnit in class AssignmentImpl

getRule

public Rule getRule()
Description copied from interface: Match
Get the rule that this match is used for.

Specified by:
getRule in interface Match
Returns:
The rule.

getNodeTarget

public EObject getNodeTarget(Node node)
Description copied from interface: Match
Get the match target for a node.

Specified by:
getNodeTarget in interface Match
Parameters:
node - The node.
Returns:
The matched target object.

setNodeTarget

public void setNodeTarget(Node node,
                          EObject target)
Description copied from interface: Match
Set the match target for a node.

Specified by:
setNodeTarget in interface Match
Parameters:
node - The node.
target - The match target.

setParameterValue

public void setParameterValue(Parameter param,
                              Object value)
Description copied from interface: Assignment
Set the assigned value for a parameter.

Specified by:
setParameterValue in interface Assignment
Overrides:
setParameterValue in class AssignmentImpl
Parameters:
param - The parameter.
value - The value to be assigned with the parameter.

getNodeTargets

public List<EObject> getNodeTargets()
Description copied from interface: Match
Get all node targets of this match.

Specified by:
getNodeTargets in interface Match
Returns:
All node targets.

getMultiMatches

public List<Match> getMultiMatches(Rule multiRule)
Description copied from interface: Match
Get the nested matches for a multi-rule.

Specified by:
getMultiMatches in interface Match
Parameters:
multiRule - The multi-rule.
Returns:
List of matches.

overlapsWith

public boolean overlapsWith(Match match)
Description copied from interface: Match
Checks whether this match overlaps with another match. The second match can be from a different rule. Two matches overlap if Match.getNodeTargets() contain shared elements.

Specified by:
overlapsWith in interface Match
Parameters:
match - A second match to check against.
Returns:
true if both matches have common targets.

isComplete

public boolean isComplete()
Description copied from interface: Match
Checks if all nodes have a target and all nested matches are also complete.

Specified by:
isComplete in interface Match
Returns:
true if all nodes are matched.

isValid

public boolean isValid()
Description copied from interface: Match
Checks whether this match is complete, whether the typing of the matched objects is correct with respect to the node types, and whether all edges are present.

Specified by:
isValid in interface Match
Returns:
true if the match is valid.

equals

public boolean equals(Object obj)
Overrides:
equals in class AssignmentImpl

toString

public String toString()
Overrides:
toString in class AssignmentImpl

toStringWithIndent

protected String toStringWithIndent(String indent)
Overrides:
toStringWithIndent in class AssignmentImpl