cc.redberry.core.transformations.substitutions
Class SubstitutionTransformation
- java.lang.Object
-
- cc.redberry.core.transformations.substitutions.SubstitutionTransformation
-
- All Implemented Interfaces:
- Transformation
public final class SubstitutionTransformation extends java.lang.Object implements Transformation
Substitution.- Since:
- 1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface cc.redberry.core.transformations.Transformation
Transformation.Util
-
-
Field Summary
-
Fields inherited from interface cc.redberry.core.transformations.Transformation
INDENTITY
-
-
Constructor Summary
Constructors Constructor and Description SubstitutionTransformation(Expression... expressions)Creates a set of substitutions.SubstitutionTransformation(Expression expression)Creates a substitution.SubstitutionTransformation(Expression[] expressions, boolean applyIfModified)Creates a set of substitutions.SubstitutionTransformation(Tensor[] from, Tensor[] to)Creates a set of substitutions.SubstitutionTransformation(Tensor[] from, Tensor[] to, boolean applyIfModified)Creates a set of substitutionsSubstitutionTransformation(Tensor from, Tensor to)Creates a substitutionSubstitutionTransformation(Tensor from, Tensor to, boolean applyIfModified)Creates a substitution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SubstitutionTransformationasSimpleSubstitution()Creates a new substitution, which treats all of the inner substitutions as simple substitutions.java.lang.StringtoString()Tensortransform(Tensor t)Transforms specified tensor and returns the result.
-
-
-
Constructor Detail
-
SubstitutionTransformation
public SubstitutionTransformation(Expression[] expressions, boolean applyIfModified)
Creates a set of substitutions.- Parameters:
expressions- an array of the expressionsapplyIfModified- if false, then if some substitution was applied to some tensor in tree, then others will be skipped in current subtree.
-
SubstitutionTransformation
public SubstitutionTransformation(Expression expression)
Creates a substitution.- Parameters:
expression- expression
-
SubstitutionTransformation
public SubstitutionTransformation(Expression... expressions)
Creates a set of substitutions.- Parameters:
expressions- an array of the expressions
-
SubstitutionTransformation
public SubstitutionTransformation(Tensor from, Tensor to, boolean applyIfModified)
Creates a substitution.- Parameters:
from- from tensorto- to tensorapplyIfModified- if false, then if some substitution was applied to some tensor in tree, then others will be skipped in current subtree.- Throws:
java.lang.IllegalArgumentException- iffromfree indices are not equal totofree indices
-
SubstitutionTransformation
public SubstitutionTransformation(Tensor[] from, Tensor[] to)
Creates a set of substitutions.- Parameters:
from- an array of from tensorsto- an array of to tensors- Throws:
java.lang.IllegalArgumentException- iffrom.length != to.lengthjava.lang.IllegalArgumentException- if for there is a pair for whichfrom[i]free indices equal toto[i]free indices
-
SubstitutionTransformation
public SubstitutionTransformation(Tensor from, Tensor to)
Creates a substitution- Parameters:
from- from tensorto- to tensor- Throws:
java.lang.IllegalArgumentException- iffromfree indices are not equal totofree indices
-
SubstitutionTransformation
public SubstitutionTransformation(Tensor[] from, Tensor[] to, boolean applyIfModified)
Creates a set of substitutions- Parameters:
from- an array of from tensorsto- an array of to tensorsapplyIfModified- if false, then if some substitution was applied to some tensor in tree, then others will be skipped in current subtree.- Throws:
java.lang.IllegalArgumentException- iffrom.length != to.lengthjava.lang.IllegalArgumentException- if for there is a pair for whichfrom[i]free indices are not equal toto[i]free indices
-
-
Method Detail
-
asSimpleSubstitution
public SubstitutionTransformation asSimpleSubstitution()
Creates a new substitution, which treats all of the inner substitutions as simple substitutions.- Returns:
- new substitution, which treats all of the inner substitutions as simple substitutions.
-
transform
public Tensor transform(Tensor t)
Description copied from interface:TransformationTransforms specified tensor and returns the result.- Specified by:
transformin interfaceTransformation- Parameters:
t- tensor- Returns:
- transformed tensor
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG