public class VisitorLevelSpecification extends AbstractVisitor
{x,{y}}
has depth 3
Modifier and Type | Field and Description |
---|---|
protected int |
fCurrentDepth |
protected int |
fCurrentLevel |
protected int |
fFromDepth |
protected int |
fFromLevel |
protected java.util.function.Function<IExpr,IExpr> |
fFunction |
protected boolean |
fIncludeHeads |
protected int |
fToDepth |
protected int |
fToLevel |
Constructor and Description |
---|
VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
IExpr expr,
boolean includeHeads)
Create a LevelSpecification from an IInteger or IAST list-object.
|
VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int level)
Define a level specification for all elements on level
level
. |
VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int level,
boolean includeHeads) |
VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int fromLevel,
int toLevel) |
VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function,
int fromLevel,
int toLevel,
boolean includeHeads) |
VisitorLevelSpecification(java.util.function.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; |
Modifier and Type | Method and Description |
---|---|
void |
decCurrentLevel() |
void |
incCurrentLevel() |
boolean |
isInRange(int level,
int depth) |
IExpr |
visit(IAST ast) |
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) |
protected int fFromLevel
protected int fToLevel
protected int fFromDepth
protected int fToDepth
protected final boolean fIncludeHeads
protected int fCurrentLevel
protected int fCurrentDepth
public VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function, IExpr expr, 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 specificationincludeHeads
- set to true
, if the header of an AST expression
should be includedMathException
- if the expr
is not a level specificationpublic VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int level)
level
.level
- public VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int level, boolean includeHeads)
public VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int fromLevel, int toLevel)
public VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int fromLevel, int toLevel, boolean includeHeads)
public VisitorLevelSpecification(java.util.function.Function<IExpr,IExpr> function, int fromLevel, int toLevel, int fromDepth, int toDepth, 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
- includeHeads
- public void incCurrentLevel()
public void decCurrentLevel()
public boolean isInRange(int level, int depth)
public IExpr visit(IInteger element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possiblepublic IExpr visit(IFraction element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possiblepublic IExpr visit(IComplex element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possiblepublic IExpr visit(INum element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possiblepublic IExpr visit(IComplexNum element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possiblepublic IExpr visit(ISymbol element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possiblepublic IExpr visit(IPattern element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possiblepublic IExpr visit(IPatternSequence element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possiblepublic IExpr visit(IStringX element)
visit
in interface IVisitor<IExpr>
visit
in class AbstractVisitor
F.NIL
, if no evaluation is possible