org.eclipse.ocl.examples.codegen.cse
Class CommonAnalysis

java.lang.Object
  extended by org.eclipse.ocl.examples.codegen.cse.AbstractAnalysis
      extended by org.eclipse.ocl.examples.codegen.cse.CommonAnalysis
All Implemented Interfaces:
java.lang.Comparable<AbstractAnalysis>

public class CommonAnalysis
extends AbstractAnalysis


Field Summary
protected  java.util.List<SimpleAnalysis> simpleAnalyses
           
 
Constructor Summary
CommonAnalysis(SimpleAnalysis firstAnalysis, SimpleAnalysis secondAnalysis)
           
 
Method Summary
 CommonAnalysis addAnalysis(AbstractAnalysis anAnalysis)
          Return the analysis that shares this analysis and anAnalysis
 CommonAnalysis addCommonAnalysis(CommonAnalysis commonAnalysis)
          Return the analysis that shares this analysis and commonAnalysis
 CommonAnalysis addedSimpleAnalysis(SimpleAnalysis simpleAnalysis)
           
 CommonAnalysis addSimpleAnalysis(SimpleAnalysis simpleAnalysis)
          Return the analysis that shares this analysis and simpleAnalysis
 int getMaxDepth()
          Return the depth of the deepest shared analysis.
 int getMinDepth()
          Return the depth of the shallowest shared analysis.
 SimpleAnalysis getPrimaryAnalysis()
           
 CGValuedElement getPrimaryElement()
          Return the CG element to be used for this analysis.
 int getStructuralHashCode()
          Return the hash code derived from the tree structure of this analysis.
 boolean isStructurallyEqualTo(AbstractAnalysis thatAnalysis)
          Return true if the tree structure of this analysis is identical to thatAnalysis.
 boolean isStructurallyEqualTo(SimpleAnalysis thatAnalysis)
          Return true if the tree structure of this analysis is identical to thatAnalysis.
 void removedSimpleAnalysis(SimpleAnalysis simpleAnalysis)
           
 void rewrite(CodeGenAnalyzer analyzer, CGValuedElement controlElement)
           
protected  CGLetExp rewriteAsLet(CGValuedElement cgIn, CGVariable cgVariable)
          Insert a CGLetExp above cgIn for cgCSE.
protected  void rewriteAsVariableExp(CGValuedElement cgElement, CGVariable cgVariable)
           
 void rewriteGlobal(CodeGenAnalyzer analyzer)
           
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.ocl.examples.codegen.cse.AbstractAnalysis
compareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

simpleAnalyses

@NonNull
protected final java.util.List<SimpleAnalysis> simpleAnalyses
Constructor Detail

CommonAnalysis

public CommonAnalysis(@NonNull
                      SimpleAnalysis firstAnalysis,
                      @NonNull
                      SimpleAnalysis secondAnalysis)
Method Detail

addAnalysis

@NonNull
public CommonAnalysis addAnalysis(@NonNull
                                          AbstractAnalysis anAnalysis)
Description copied from class: AbstractAnalysis
Return the analysis that shares this analysis and anAnalysis

Specified by:
addAnalysis in class AbstractAnalysis

addCommonAnalysis

@NonNull
public CommonAnalysis addCommonAnalysis(@NonNull
                                                CommonAnalysis commonAnalysis)
Description copied from class: AbstractAnalysis
Return the analysis that shares this analysis and commonAnalysis

Specified by:
addCommonAnalysis in class AbstractAnalysis

addSimpleAnalysis

@NonNull
public CommonAnalysis addSimpleAnalysis(@NonNull
                                                SimpleAnalysis simpleAnalysis)
Description copied from class: AbstractAnalysis
Return the analysis that shares this analysis and simpleAnalysis

Specified by:
addSimpleAnalysis in class AbstractAnalysis

addedSimpleAnalysis

@NonNull
public CommonAnalysis addedSimpleAnalysis(@NonNull
                                                  SimpleAnalysis simpleAnalysis)

getMaxDepth

public int getMaxDepth()
Description copied from class: AbstractAnalysis
Return the depth of the deepest shared analysis.

Specified by:
getMaxDepth in class AbstractAnalysis

getMinDepth

public int getMinDepth()
Description copied from class: AbstractAnalysis
Return the depth of the shallowest shared analysis.

Specified by:
getMinDepth in class AbstractAnalysis

getPrimaryAnalysis

@NonNull
public SimpleAnalysis getPrimaryAnalysis()

getPrimaryElement

@NonNull
public CGValuedElement getPrimaryElement()
Description copied from class: AbstractAnalysis
Return the CG element to be used for this analysis. For common subexpressions, the return is the shallowest CG element and is visible to all other secondary elements.

Specified by:
getPrimaryElement in class AbstractAnalysis

getStructuralHashCode

public int getStructuralHashCode()
Description copied from class: AbstractAnalysis
Return the hash code derived from the tree structure of this analysis.

Specified by:
getStructuralHashCode in class AbstractAnalysis

isStructurallyEqualTo

public boolean isStructurallyEqualTo(@NonNull
                                     AbstractAnalysis thatAnalysis)
Description copied from class: AbstractAnalysis
Return true if the tree structure of this analysis is identical to thatAnalysis.

Specified by:
isStructurallyEqualTo in class AbstractAnalysis

isStructurallyEqualTo

public boolean isStructurallyEqualTo(@NonNull
                                     SimpleAnalysis thatAnalysis)
Description copied from class: AbstractAnalysis
Return true if the tree structure of this analysis is identical to thatAnalysis.

Specified by:
isStructurallyEqualTo in class AbstractAnalysis

removedSimpleAnalysis

public void removedSimpleAnalysis(SimpleAnalysis simpleAnalysis)

rewrite

public void rewrite(@NonNull
                    CodeGenAnalyzer analyzer,
                    @NonNull
                    CGValuedElement controlElement)

rewriteAsLet

@NonNull
protected CGLetExp rewriteAsLet(@NonNull
                                        CGValuedElement cgIn,
                                        @NonNull
                                        CGVariable cgVariable)
Insert a CGLetExp above cgIn for cgCSE.


rewriteAsVariableExp

protected void rewriteAsVariableExp(@NonNull
                                    CGValuedElement cgElement,
                                    @NonNull
                                    CGVariable cgVariable)

rewriteGlobal

public void rewriteGlobal(@NonNull
                          CodeGenAnalyzer analyzer)

toString

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