com.vladsch.flexmark.tree.iteration.NodeIterator Maven / Gradle / Ivy
package com.vladsch.flexmark.tree.iteration;
import com.vladsch.flexmark.util.ast.Node;
import org.jetbrains.annotations.NotNull;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
public class NodeIterator extends MappedIterator {
public NodeIterator(@NotNull Node element, @NotNull ValueIterationAdapter super Node, N> adapter, @NotNull TreeIterator treeIterator) {
super(element, adapter, treeIterator);
}
// *******************************************************
//
// Need Subclass Constructors
//
// *******************************************************
@NotNull
public NodeIterator getModifiedCopy(Node element, ValueIterationAdapter super Node, N> adapter, TreeIterator treeIterator) {
return new NodeIterator<>(element, adapter, treeIterator);
}
@NotNull
public NodeIterator getModifiedCopyF(Node element, ValueIterationAdapter super Node, F> adapter, TreeIterator treeIterator) {
return new NodeIterator<>(element, adapter, treeIterator);
}
// *******************************************************
//
// Need Overrides with cast to sub-class
//
// *******************************************************
@NotNull
@Override
public NodeIterator reversed() {
return (NodeIterator) super.reversed();
}
@NotNull
@Override
public NodeIterator recursive() {
return (NodeIterator) super.recursive();
}
@NotNull
@Override
public NodeIterator nonRecursive() {
return (NodeIterator) super.nonRecursive();
}
@NotNull
@Override
public NodeIterator recursive(boolean recursive) {
return (NodeIterator) super.recursive(recursive);
}
@NotNull
@Override
public NodeIterator nonRecursive(boolean nonRecursive) {
return (NodeIterator) super.nonRecursive(nonRecursive);
}
@NotNull
@Override
public NodeIterator recurse(@NotNull Predicate super Node> predicate) {
return (NodeIterator) super.recurse(predicate);
}
@NotNull
@Override
public NodeIterator recurse(@NotNull Class super Node> clazz) {
return (NodeIterator) super.recurse(clazz);
}
@NotNull
@Override
public NodeIterator recurse(@NotNull Class clazz, @NotNull Predicate super F> predicate) {
return (NodeIterator) super.recurse(clazz, predicate);
}
@NotNull
@Override
public NodeIterator noRecurse(@NotNull Predicate super Node> predicate) {
return (NodeIterator) super.noRecurse(predicate);
}
@NotNull
@Override
public NodeIterator noRecurse(@NotNull Class super Node> clazz) {
return (NodeIterator) super.noRecurse(clazz);
}
@NotNull
@Override
public NodeIterator noRecurse(@NotNull Class clazz, @NotNull Predicate super F> predicate) {
return (NodeIterator) super.noRecurse(clazz, predicate);
}
@NotNull
@Override
public NodeIterator filterFalse() {
return (NodeIterator) super.filterFalse();
}
@NotNull
@Override
public NodeIterator aborted() {
return (NodeIterator) super.aborted();
}
@NotNull
@Override
public NodeIterator filterOut(@NotNull Predicate super Node> predicate) {
return (NodeIterator) super.filterOut(predicate);
}
@NotNull
@Override
public NodeIterator filterOut(@NotNull Class super Node> clazz) {
return (NodeIterator) super.filterOut(clazz);
}
@NotNull
@Override
public NodeIterator filterOut(@NotNull Class clazz, @NotNull Predicate super F> predicate) {
return (NodeIterator) super.filterOut(clazz, predicate);
}
@NotNull
@Override
public NodeIterator filter(@NotNull Predicate super Node> predicate) {
return (NodeIterator) super.filter(predicate);
}
@NotNull
@Override
public NodeIterator acceptFilter(@NotNull ValueIterationFilter super N> filter) {
return (NodeIterator) super.acceptFilter(filter);
}
// *******************************************************
//
// Mapping Functions
//
// *******************************************************
@NotNull
@Override
public NodeIterator filter(@NotNull Class clazz) {
return (NodeIterator) super.filter(clazz);
}
@NotNull
@Override
public NodeIterator filter(@NotNull Class clazz, @NotNull Predicate super F> predicate) {
return (NodeIterator) super.filter(clazz, predicate);
}
@NotNull
@Override
public NodeIterator adapt(@NotNull Function super N, F> adapter) {
return (NodeIterator) super.adapt(adapter);
}
@NotNull
@Override
public NodeIterator adapt(@NotNull ValueIterationAdapter super N, F> adapter) {
return (NodeIterator) super.adapt(adapter);
}
// *******************************************************
//
// Node Looping specific
//
// *******************************************************
@NotNull
public NodeIterator recurse(@NotNull Set> nodeClassSet) {
return getModifiedCopyF(myElement, myAdapter, myTreeIterator.recurse(it -> nodeClassSet.contains(it.getClass())));
}
@NotNull
public NodeIterator filterOut(@NotNull Set> nodeClassSet) {
return getModifiedCopyF(myElement, myAdapter, myTreeIterator.filterOut(it -> nodeClassSet.contains(it.getClass())));
}
@NotNull
public NodeIterator filter(@NotNull Set> nodeClassSet) {
return getModifiedCopyF(myElement, myAdapter, myTreeIterator.filter(it -> nodeClassSet.contains(it.getClass())));
}
@NotNull
public MappedIterator
© 2015 - 2025 Weber Informatics LLC | Privacy Policy