Class AbstractNodeItemVisitor<RESULT,CONTEXT>
- java.lang.Object
-
- gov.nist.secauto.metaschema.core.metapath.item.node.AbstractNodeItemVisitor<RESULT,CONTEXT>
-
- Type Parameters:
RESULT
- the type of result produced by visitationCONTEXT
- the type of data to pass to each visited node
- All Implemented Interfaces:
INodeItemVisitor<RESULT,CONTEXT>
- Direct Known Subclasses:
ValidatingNodeItemVisitor
public abstract class AbstractNodeItemVisitor<RESULT,CONTEXT> extends Object implements INodeItemVisitor<RESULT,CONTEXT>
Used by implementations of this class to visit a sequence of node items in a directed graph, using depth-first ordering.
-
-
Constructor Summary
Constructors Constructor Description AbstractNodeItemVisitor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected RESULT
aggregateResult(RESULT first, RESULT second, CONTEXT context)
Combine two results into a single, aggregate result.protected abstract RESULT
defaultResult()
The initial, default visitation result, which will be used as the basis for aggregating results produced when visiting.protected boolean
shouldVisitNextChild(INodeItem parent, IModelNodeItem<?,?> child, RESULT result, CONTEXT context)
Determine if the child should be visited next, or skipped.protected boolean
shouldVisitNextChild(INodeItem parent, INodeItem child, RESULT result, CONTEXT context)
Determine if the child should be visited next, or skipped.RESULT
visit(INodeItemVisitable item, CONTEXT context)
Visit the provideditem
.RESULT
visitAssembly(IAssemblyNodeItem item, CONTEXT context)
This callback is called when anIAssemblyNodeItem
is visited.RESULT
visitDocument(IDocumentNodeItem item, CONTEXT context)
This callback is called when theIDocumentNodeItem
is visited.RESULT
visitField(IFieldNodeItem item, CONTEXT context)
This callback is called when anIFieldNodeItem
is visited.RESULT
visitFlag(IFlagNodeItem item, CONTEXT context)
This callback is called when anIFlagNodeItem
is visited.protected RESULT
visitFlags(INodeItem item, CONTEXT context)
Visit any child flags associated with the provideditem
.RESULT
visitMetaschema(IModuleNodeItem item, CONTEXT context)
This callback is called when anIModuleNodeItem
is visited.protected RESULT
visitModelChildren(INodeItem item, CONTEXT context)
Visit any child model items associated with the provideditem
.
-
-
-
Constructor Detail
-
AbstractNodeItemVisitor
public AbstractNodeItemVisitor()
-
-
Method Detail
-
visit
public final RESULT visit(@NonNull INodeItemVisitable item, CONTEXT context)
Visit the provideditem
.- Parameters:
item
- the item to visitcontext
- provides contextual information for use by the visitor- Returns:
- the result produced by visiting the item
-
visitFlags
protected RESULT visitFlags(@NonNull INodeItem item, CONTEXT context)
Visit any child flags associated with the provideditem
.- Parameters:
item
- the item to visitcontext
- provides contextual information for use by the visitor- Returns:
- the result produced by visiting the item's flags
-
visitModelChildren
protected RESULT visitModelChildren(@NonNull INodeItem item, CONTEXT context)
Visit any child model items associated with the provideditem
.- Parameters:
item
- the item to visitcontext
- provides contextual information for use by the visitor- Returns:
- the result produced by visiting the item's child model items
-
shouldVisitNextChild
protected boolean shouldVisitNextChild(@NonNull INodeItem parent, @NonNull INodeItem child, RESULT result, CONTEXT context)
Determine if the child should be visited next, or skipped.- Parameters:
parent
- the parent of the child to visit nextchild
- the next child to visitresult
- the current visitation resultcontext
- provides contextual information for use by the visitor- Returns:
true
if the child should be visited, orfalse
if the child should be skipped
-
shouldVisitNextChild
protected boolean shouldVisitNextChild(@NonNull INodeItem parent, @NonNull IModelNodeItem<?,?> child, RESULT result, CONTEXT context)
Determine if the child should be visited next, or skipped.- Parameters:
parent
- the parent of the child to visit nextchild
- the next child to visitresult
- the current visitation resultcontext
- provides contextual information for use by the visitor- Returns:
true
if the child should be visited, orfalse
if the child should be skipped
-
defaultResult
protected abstract RESULT defaultResult()
The initial, default visitation result, which will be used as the basis for aggregating results produced when visiting.- Returns:
- the default result
- See Also:
aggregateResult(Object, Object, Object)
-
aggregateResult
protected RESULT aggregateResult(RESULT first, RESULT second, CONTEXT context)
Combine two results into a single, aggregate result.- Parameters:
first
- the original resultsecond
- the new result to combine with the original resultcontext
- provides contextual information for use by the visitor- Returns:
- the combined result
-
visitDocument
public RESULT visitDocument(IDocumentNodeItem item, CONTEXT context)
Description copied from interface:INodeItemVisitor
This callback is called when theIDocumentNodeItem
is visited.- Specified by:
visitDocument
in interfaceINodeItemVisitor<RESULT,CONTEXT>
- Parameters:
item
- the visited itemcontext
- provides contextual information for use by the visitor- Returns:
- the visitation result
-
visitFlag
public RESULT visitFlag(IFlagNodeItem item, CONTEXT context)
Description copied from interface:INodeItemVisitor
This callback is called when anIFlagNodeItem
is visited.- Specified by:
visitFlag
in interfaceINodeItemVisitor<RESULT,CONTEXT>
- Parameters:
item
- the visited itemcontext
- provides contextual information for use by the visitor- Returns:
- the visitation result
-
visitField
public RESULT visitField(IFieldNodeItem item, CONTEXT context)
Description copied from interface:INodeItemVisitor
This callback is called when anIFieldNodeItem
is visited.- Specified by:
visitField
in interfaceINodeItemVisitor<RESULT,CONTEXT>
- Parameters:
item
- the visited itemcontext
- provides contextual information for use by the visitor- Returns:
- the visitation result
-
visitAssembly
public RESULT visitAssembly(IAssemblyNodeItem item, CONTEXT context)
Description copied from interface:INodeItemVisitor
This callback is called when anIAssemblyNodeItem
is visited.- Specified by:
visitAssembly
in interfaceINodeItemVisitor<RESULT,CONTEXT>
- Parameters:
item
- the visited itemcontext
- provides contextual information for use by the visitor- Returns:
- the visitation result
-
visitMetaschema
public RESULT visitMetaschema(IModuleNodeItem item, CONTEXT context)
Description copied from interface:INodeItemVisitor
This callback is called when anIModuleNodeItem
is visited.- Specified by:
visitMetaschema
in interfaceINodeItemVisitor<RESULT,CONTEXT>
- Parameters:
item
- the visited itemcontext
- provides contextual information for use by the visitor- Returns:
- the visitation result
-
-