public class VisitorRemoveLevelSpecification extends VisitorLevelSpecification
visit(IAST clonedAST)
method.
Example: the nested list {x,{y}}
has depth 3
Modifier and Type | Class and Description |
---|---|
static class |
VisitorRemoveLevelSpecification.StopException
StopException will be thrown, if maximum number of Cases results are
reached
|
fCurrentDepth, fCurrentLevel, fFromDepth, fFromLevel, fFunction, fIncludeHeads, fToDepth, fToLevel
Constructor and Description |
---|
VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
IExpr expr,
int maximumRemoved,
boolean includeHeads)
Create a LevelSpecification from an IInteger or IAST list-object.
|
VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int level)
Define a level specification for all elements on level
level
. |
VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int level,
boolean includeHeads) |
VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int fromLevel,
int toLevel) |
VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int fromLevel,
int toLevel,
boolean includeHeads) |
VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int fromLevel,
int toLevel,
int fromDepth,
int toDepth,
int maximumRemoved,
boolean includeHeads)
Example value set for including all levels:
fromLevel = 0; toLevel = Integer.MAX_VALUE; fromDepth = Integer.MIN_VALUE; toDepth = -1; |
Modifier and Type | Method and Description |
---|---|
int |
getRemovedCounter()
Get the number of remove operations.
|
IExpr |
visit(IAST clonedAST)
Note: the given AST will be modified, i.e. some elements may be
removed!
|
IExpr |
visit(IComplex element) |
IExpr |
visit(IComplexNum element) |
IExpr |
visit(IFraction element) |
IExpr |
visit(IInteger element) |
IExpr |
visit(INum element) |
IExpr |
visit(IPattern element) |
IExpr |
visit(IPatternSequence element) |
IExpr |
visit(IStringX element) |
IExpr |
visit(ISymbol element) |
IExpr |
visitExpr(IExpr element) |
decCurrentLevel, incCurrentLevel, isInRange
public VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function, IExpr expr, int maximumRemoved, boolean includeHeads)
expr
is interpreted as a level specification for
the allowed levels in an AST.expr
is a non-negative IInteger iValue set Level
{1,iValue};expr
is a negative IInteger iValue set Level {iValue, 0};
expr
is a List {i0Value, i1Value} set Level {i0Value,
i1Value};function
- the function which should be applied for an elementexpr
- the given level specificationmaximumRemoved
- maximum number of elements, which are allowed to removeincludeHeads
- set to true
, if the header of an AST expression
should be includedMathException
- if the expr
is not a level specificationpublic VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int level)
level
.level
- public VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int level, boolean includeHeads)
public VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int fromLevel, int toLevel)
public VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int fromLevel, int toLevel, boolean includeHeads)
public VisitorRemoveLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int fromLevel, int toLevel, int fromDepth, int toDepth, int maximumRemoved, boolean includeHeads)
fromLevel = 0;
toLevel = Integer.MAX_VALUE;
fromDepth = Integer.MIN_VALUE;
toDepth = -1;
function
- the function which should be applied for an elementfromLevel
- toLevel
- fromDepth
- toDepth
- maximumRemoved
- maximum number of elements, which are allowed to removeincludeHeads
- public int getRemovedCounter()
public IExpr visit(IInteger element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visit(IFraction element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visit(IComplex element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visit(INum element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visit(IComplexNum element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visit(ISymbol element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visit(IPattern element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visit(IPatternSequence element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visit(IStringX element)
visit
in interface IVisitor<IExpr>
visit
in class VisitorLevelSpecification
F.NIL
, if no evaluation is possiblepublic IExpr visitExpr(IExpr element)
visitExpr
in class VisitorLevelSpecification