Package org.glassfish.rmic.iiop
Class ContextStack
- java.lang.Object
-
- org.glassfish.rmic.iiop.ContextStack
-
public class ContextStack extends java.lang.ObjectContextStack provides a mechanism to record parsing state.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String[]CODE_NAMESprivate intcurrentIndexprivate BatchEnvironmentenvstatic intEXTENDSstatic intIMPLEMENTSprivate intmaxIndexstatic intMEMBERstatic intMEMBER_CONSTANTstatic intMEMBER_STATICstatic intMEMBER_TRANSIENTstatic intMETHODstatic intMETHOD_ARGUMENTstatic intMETHOD_EXCEPTIONstatic intMETHOD_RETURNprivate intnewCodeprivate TypeContext[]stackprivate TypeContexttempContextstatic intTOPprivate booleantraceprivate static java.lang.StringTRACE_INDENT
-
Constructor Summary
Constructors Constructor Description ContextStack(BatchEnvironment env)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleananyErrors()Return true ifenv.nerrors > 0.voidclear()static voiddumpCallStack()TypeContextgetContext()Get the current top context.TypeContextgetContext(int index)Get a specific context.java.lang.StringgetContextCodeString()Get a string for the context name...static java.lang.StringgetContextCodeString(int contextCode)Get a string for the given context code...intgetCurrentContextCode()Get the current context code.BatchEnvironmentgetEnv()Get the environment.TypeContextgetParentContext()Get parent context.booleanisParentAValue()Is parent context a value type?booleanisTraceOn()Check trace flag.TypeContextpop(boolean wasValid)Pop an element from the stack.TypeContextpush(ContextElement element)Push a new element on the stack.voidsetNewContextCode(int code)Set the new context.voidsetTrace(boolean trace)Enable/disable tracing.intsize()Get the current size.private java.lang.StringtoResultString(TypeContext it, boolean result, boolean preExisting)private java.lang.StringtoTrialString(TypeContext it)(package private) voidtrace(java.lang.String text)If tracing on, print a line.(package private) voidtraceCallStack()If tracing on, write the current call stack (not the context stack) to System.out.(package private) voidtraceExistingType(Type type)If tracing on, print a pre-mapped ContextElement.(package private) voidtraceln(java.lang.String text)If tracing on, print a line followed by a '\n'.private voidtracePrint(java.lang.String text, boolean line)Print a line indented by stack depth.
-
-
-
Field Detail
-
TOP
public static final int TOP
- See Also:
- Constant Field Values
-
METHOD
public static final int METHOD
- See Also:
- Constant Field Values
-
METHOD_RETURN
public static final int METHOD_RETURN
- See Also:
- Constant Field Values
-
METHOD_ARGUMENT
public static final int METHOD_ARGUMENT
- See Also:
- Constant Field Values
-
METHOD_EXCEPTION
public static final int METHOD_EXCEPTION
- See Also:
- Constant Field Values
-
MEMBER
public static final int MEMBER
- See Also:
- Constant Field Values
-
MEMBER_CONSTANT
public static final int MEMBER_CONSTANT
- See Also:
- Constant Field Values
-
MEMBER_STATIC
public static final int MEMBER_STATIC
- See Also:
- Constant Field Values
-
MEMBER_TRANSIENT
public static final int MEMBER_TRANSIENT
- See Also:
- Constant Field Values
-
IMPLEMENTS
public static final int IMPLEMENTS
- See Also:
- Constant Field Values
-
EXTENDS
public static final int EXTENDS
- See Also:
- Constant Field Values
-
CODE_NAMES
private static final java.lang.String[] CODE_NAMES
-
currentIndex
private int currentIndex
-
maxIndex
private int maxIndex
-
stack
private TypeContext[] stack
-
newCode
private int newCode
-
env
private BatchEnvironment env
-
trace
private boolean trace
-
tempContext
private TypeContext tempContext
-
TRACE_INDENT
private static final java.lang.String TRACE_INDENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContextStack
public ContextStack(BatchEnvironment env)
Constructor.
-
-
Method Detail
-
anyErrors
public boolean anyErrors()
Return true ifenv.nerrors > 0.
-
setTrace
public void setTrace(boolean trace)
Enable/disable tracing.
-
isTraceOn
public boolean isTraceOn()
Check trace flag.
-
getEnv
public BatchEnvironment getEnv()
Get the environment.
-
setNewContextCode
public void setNewContextCode(int code)
Set the new context.
-
getCurrentContextCode
public int getCurrentContextCode()
Get the current context code.
-
traceCallStack
final void traceCallStack()
If tracing on, write the current call stack (not the context stack) to System.out.
-
dumpCallStack
public static final void dumpCallStack()
-
tracePrint
private final void tracePrint(java.lang.String text, boolean line)Print a line indented by stack depth.
-
trace
final void trace(java.lang.String text)
If tracing on, print a line.
-
traceln
final void traceln(java.lang.String text)
If tracing on, print a line followed by a '\n'.
-
traceExistingType
final void traceExistingType(Type type)
If tracing on, print a pre-mapped ContextElement.
-
push
public TypeContext push(ContextElement element)
Push a new element on the stack.- Returns:
- the new element.
-
pop
public TypeContext pop(boolean wasValid)
Pop an element from the stack.- Returns:
- the new current element or null if top.
-
size
public int size()
Get the current size.
-
getContext
public TypeContext getContext(int index)
Get a specific context.
-
getContext
public TypeContext getContext()
Get the current top context.
-
isParentAValue
public boolean isParentAValue()
Is parent context a value type?
-
getParentContext
public TypeContext getParentContext()
Get parent context. Null if none.
-
getContextCodeString
public java.lang.String getContextCodeString()
Get a string for the context name...
-
getContextCodeString
public static java.lang.String getContextCodeString(int contextCode)
Get a string for the given context code...
-
toTrialString
private java.lang.String toTrialString(TypeContext it)
-
toResultString
private java.lang.String toResultString(TypeContext it, boolean result, boolean preExisting)
-
clear
public void clear()
-
-