private class LogicalTerminal.ScopeProcessor extends java.lang.Object implements ConditionListener
| Modifier and Type | Field and Description |
|---|---|
private boolean |
canHide
Track frame hiding in current scope.
|
private java.util.HashMap<java.lang.Integer,GenericFrame> |
deepFrames
Frames registered at previous scope.
|
private boolean |
deferReset
Track if any exception was raised in this block.
|
private boolean |
forceCanHide
Set 'canHide' flag on the next iteration.
|
private java.util.HashMap<java.lang.Integer,GenericFrame> |
frames
Frames registered at current scope.
|
private boolean |
hadException
Track if any ENDKEY/ERROR condition was raised in this block.
|
private boolean |
hadWrap
Frame in scope has been wrapped.
|
private java.util.ArrayList<java.lang.Integer> |
hidden
List of frames which were marked for hiding last time.
|
private int |
innerViewed
Maximal number of frames viewed in nested blocks.
|
private int |
interactionsAtEntry
A snapshot of the interactions counter at block entry.
|
private boolean |
isException
Mark exception from general hiding rule.
|
private boolean |
marked
Set to
true when first non-empty list of frames was
marked for hiding. |
private LogicalTerminal.ScopeProcessor |
prev
Reference to previous scope in the chain.
|
private boolean |
realTopLevel
Mark external procedure scope.
|
private int |
savedInnerViewed
Number of viewed frames in outer scope.
|
private boolean |
topLevel
Mark inherited or temporary external procedure scope.
|
private org.roaringbitmap.RoaringBitmap |
viewed
Viewed in current iteration frames.
|
| Constructor and Description |
|---|
ScopeProcessor()
Create new instance.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
clearTopLevelFlag()
Clear top level procedure flag.
|
void |
condition(BlockManager.Condition condition)
Provides a notification that a
ConditionException or an
unexpected Throwable was encountered for the current
block. |
private void |
deferMarkFrames(java.util.ArrayList<java.lang.Integer> list,
int mode)
Setup the deferral processing to mark frames for hiding.
|
void |
deleted()
This implementation does nothing.
|
void |
finished()
Process end of block scope.
|
void |
forceHiding()
Clear map of viewed frames.
|
void |
frameViewed(GenericFrame frame)
Notify scope that frame is viewed.
|
void |
frameWrapped(java.lang.Integer id)
Notify that frame is wrapped during DOWN or UP processing.
|
private java.util.HashMap<java.lang.Integer,GenericFrame> |
getDeepFrames()
Get the
deepFrames map and create it if it does not exist. |
private java.util.HashMap<java.lang.Integer,GenericFrame> |
getFrames()
Get the
frames map and create it if it does not exist. |
private java.util.ArrayList<java.lang.Integer> |
getHidden()
Get the
hidden list and create it if it does not exist. |
private org.roaringbitmap.RoaringBitmap |
getViewed()
Get the
viewed set and create it if it does not exist. |
private boolean |
hasDeepFrames()
Check if the
deepFrames map exists and is not empty. |
private boolean |
hasFrames()
Check if the
frames map exists and is not empty. |
private boolean |
hasHidden()
Check if the
hidden list exists and is not empty. |
private boolean |
hasViewed()
Check if the
viewed set exists and is not empty. |
private boolean |
isDoBlock(BlockType type)
Check current block scope for type of block.
|
private boolean |
isSpecialBlock(BlockType type)
Check type of current block and return
true if this is
some kind of FOR or REPEAT loop. |
void |
iterate()
Process iteration of block nesting scope.
|
private void |
process(boolean isRetry)
Handle block iteration and retry.
|
void |
register(GenericFrame frame)
Register frame at current scope.
|
void |
retry()
Process retrying of the block nesting scope.
|
java.lang.String |
toString()
Prepare human readable representations of the instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitentry, initFailure, weightprivate java.util.HashMap<java.lang.Integer,GenericFrame> frames
private java.util.HashMap<java.lang.Integer,GenericFrame> deepFrames
private LogicalTerminal.ScopeProcessor prev
private boolean marked
true when first non-empty list of frames was
marked for hiding.private boolean hadException
private boolean deferReset
private java.util.ArrayList<java.lang.Integer> hidden
private org.roaringbitmap.RoaringBitmap viewed
private boolean canHide
private boolean isException
private int innerViewed
private boolean hadWrap
private int savedInnerViewed
private final boolean realTopLevel
private boolean topLevel
private boolean forceCanHide
private int interactionsAtEntry
public void forceHiding()
public void frameViewed(GenericFrame frame)
frame - Frame which is about to be viewed.public void frameWrapped(java.lang.Integer id)
id - public void finished()
finished in interface FinalizableFinalizable.finished()public void deleted()
deleted in interface Finalizablepublic void register(GenericFrame frame)
frame - Frame to register.public void iterate()
iterate in interface Finalizablepublic void retry()
retry in interface Finalizablepublic void condition(BlockManager.Condition condition)
ConditionException or an
unexpected Throwable was encountered for the current
block.
This method will reset the interactions counter for any block that
has the ENDKEY property. This is done to ensure that
if the block is exited, that the current block's interactions will
not be added to the containing block's interactions. If the block
is retried or iterated, then the counter is going to be reset
anyway so this has no negative effect.
If the exception was for ERROR or ENDKEY
then a flag will be set to allow exit processing to be modified
accordingly.
condition in interface ConditionListenercondition - The condition thrown during block processing.private void clearTopLevelFlag()
private void process(boolean isRetry)
isRetry - Allows differentiation of behavior for retry and iterate.private void deferMarkFrames(java.util.ArrayList<java.lang.Integer> list,
int mode)
list - Array of frame IDs.mode - Code of the performed operation.private boolean isDoBlock(BlockType type)
type - The current block's type.true if current block scope is a DO block.private boolean isSpecialBlock(BlockType type)
true if this is
some kind of FOR or REPEAT loop. This excludes non-looping FOR
blocks.type - The current block's type.true if current block is a FOR
loop or REPEAT block.private boolean hasViewed()
viewed set exists and is not empty.private boolean hasFrames()
frames map exists and is not empty.private boolean hasDeepFrames()
deepFrames map exists and is not empty.private boolean hasHidden()
hidden list exists and is not empty.private org.roaringbitmap.RoaringBitmap getViewed()
viewed set and create it if it does not exist.private java.util.HashMap<java.lang.Integer,GenericFrame> getDeepFrames()
deepFrames map and create it if it does not exist.private java.util.HashMap<java.lang.Integer,GenericFrame> getFrames()
frames map and create it if it does not exist.private java.util.ArrayList<java.lang.Integer> getHidden()
hidden list and create it if it does not exist.public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()