Package org.glassfish.rmic.iiop
Class ContextStack
- java.lang.Object
-
- org.glassfish.rmic.iiop.ContextStack
-
public class ContextStack extends java.lang.Object
ContextStack provides a mechanism to record parsing state.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String[]
CODE_NAMES
private int
currentIndex
private BatchEnvironment
env
static int
EXTENDS
static int
IMPLEMENTS
private int
maxIndex
static int
MEMBER
static int
MEMBER_CONSTANT
static int
MEMBER_STATIC
static int
MEMBER_TRANSIENT
static int
METHOD
static int
METHOD_ARGUMENT
static int
METHOD_EXCEPTION
static int
METHOD_RETURN
private int
newCode
private TypeContext[]
stack
private TypeContext
tempContext
static int
TOP
private boolean
trace
private static java.lang.String
TRACE_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 boolean
anyErrors()
Return true ifenv.nerrors > 0
.void
clear()
static void
dumpCallStack()
TypeContext
getContext()
Get the current top context.TypeContext
getContext(int index)
Get a specific context.java.lang.String
getContextCodeString()
Get a string for the context name...static java.lang.String
getContextCodeString(int contextCode)
Get a string for the given context code...int
getCurrentContextCode()
Get the current context code.BatchEnvironment
getEnv()
Get the environment.TypeContext
getParentContext()
Get parent context.boolean
isParentAValue()
Is parent context a value type?boolean
isTraceOn()
Check trace flag.TypeContext
pop(boolean wasValid)
Pop an element from the stack.TypeContext
push(ContextElement element)
Push a new element on the stack.void
setNewContextCode(int code)
Set the new context.void
setTrace(boolean trace)
Enable/disable tracing.int
size()
Get the current size.private java.lang.String
toResultString(TypeContext it, boolean result, boolean preExisting)
private java.lang.String
toTrialString(TypeContext it)
(package private) void
trace(java.lang.String text)
If tracing on, print a line.(package private) void
traceCallStack()
If tracing on, write the current call stack (not the context stack) to System.out.(package private) void
traceExistingType(Type type)
If tracing on, print a pre-mapped ContextElement.(package private) void
traceln(java.lang.String text)
If tracing on, print a line followed by a '\n'.private void
tracePrint(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()
-
-