org.matheclipse.core.visit
Class VisitorLevelSpecification
- java.lang.Object
-
- org.matheclipse.core.visit.AbstractVisitor<IExpr>
-
- org.matheclipse.core.visit.VisitorLevelSpecification
-
public class VisitorLevelSpecification extends AbstractVisitor<IExpr>
A level specification visitor for levels in abstract syntax trees (AST). Example: the nested list[x,[y]]has depth3
-
-
Constructor Summary
Constructors Constructor and Description VisitorLevelSpecification(Function<IExpr,IExpr> function, IExpr expr, boolean includeHeads)Create a LevelSpecification from an IInteger or IAST list-object.
Anexpris interpreted as a level specification for the allowed levels in an AST.
Ifexpris a non-negative IInteger iValue set Level {1,iValue};
Ifexpris a negative IInteger iValue set Level {iValue, 0};
Ifexpris a List {i0Value, i1Value} set Level {i0Value, i1Value};VisitorLevelSpecification(Function<IExpr,IExpr> function, int level)Define a level specification for all elements on levellevel.VisitorLevelSpecification(Function<IExpr,IExpr> function, int level, boolean includeHeads)VisitorLevelSpecification(Function<IExpr,IExpr> function, int fromLevel, int toLevel)VisitorLevelSpecification(Function<IExpr,IExpr> function, int fromLevel, int toLevel, boolean includeHeads)VisitorLevelSpecification(Function<IExpr,IExpr> function, int fromLevel, int toLevel, int fromDepth, int toDepth, boolean includeHeads)Example value set for including all levels:
fromLevel = 0;
toLevel = Integer.MAX_VALUE;
fromDepth = Integer.MIN_VALUE;
toDepth = -1;
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddecCurrentLevel()voidincCurrentLevel()booleanisInRange(int level, int depth)IExprvisit(IAST ast)IExprvisit(IComplex element)IExprvisit(IComplexNum element)IExprvisit(IFraction element)IExprvisit(IInteger element)IExprvisit(INum element)IExprvisit(IPattern element)IExprvisit(IPatternSequence element)IExprvisit(IStringX element)IExprvisit(ISymbol element)IExprvisitExpr(IExpr element)
-
-
-
Constructor Detail
-
VisitorLevelSpecification
public VisitorLevelSpecification(Function<IExpr,IExpr> function, IExpr expr, boolean includeHeads)
Create a LevelSpecification from an IInteger or IAST list-object.
Anexpris interpreted as a level specification for the allowed levels in an AST.
Ifexpris a non-negative IInteger iValue set Level {1,iValue};
Ifexpris a negative IInteger iValue set Level {iValue, 0};
Ifexpris a List {i0Value, i1Value} set Level {i0Value, i1Value};- Parameters:
function- the function which should be applied for an elementexpr- the given level specificationincludeHeads- set totrue, if the header of an AST expression should be included- Throws:
MathException- if theexpris not a level specification
-
VisitorLevelSpecification
public VisitorLevelSpecification(Function<IExpr,IExpr> function, int level)
Define a level specification for all elements on levellevel.- Parameters:
level-
-
VisitorLevelSpecification
public VisitorLevelSpecification(Function<IExpr,IExpr> function, int level, boolean includeHeads)
-
VisitorLevelSpecification
public VisitorLevelSpecification(Function<IExpr,IExpr> function, int fromLevel, int toLevel)
-
VisitorLevelSpecification
public VisitorLevelSpecification(Function<IExpr,IExpr> function, int fromLevel, int toLevel, boolean includeHeads)
-
VisitorLevelSpecification
public VisitorLevelSpecification(Function<IExpr,IExpr> function, int fromLevel, int toLevel, int fromDepth, int toDepth, boolean includeHeads)
Example value set for including all levels:
fromLevel = 0;
toLevel = Integer.MAX_VALUE;
fromDepth = Integer.MIN_VALUE;
toDepth = -1;- Parameters:
function- the function which should be applied for an elementfromLevel-toLevel-fromDepth-toDepth-includeHeads-
-
-
Method Detail
-
incCurrentLevel
public void incCurrentLevel()
-
decCurrentLevel
public void decCurrentLevel()
-
isInRange
public boolean isInRange(int level, int depth)
-
visit
public IExpr visit(IComplexNum element)
-
visit
public IExpr visit(IPatternSequence element)
-
-
DMelt 3.0 © DataMelt by jWork.ORG