mjc

org.multijava.mjc
Class CParseClassContext

java.lang.Object
  extended byorg.multijava.mjc.CParseClassContext

public class CParseClassContext
extends Object

This class is used by the parser to collect the members of a class declaration. For efficiency (and to avoid memory leaks caused by poor garbage collection in the JVM) a factory method is used to generate instances and old instances are store on a stack for reuse.


Field Summary
private  ArrayList fieldsAndInits
           
private  ArrayList inners
           
private  ArrayList methods
           
private static Stack stack
           
 
Constructor Summary
protected CParseClassContext()
          Hides the default constructor except to subclasses.
 
Method Summary
 void addBlockInitializer(JClassBlock block)
           
 void addFieldDeclaration(JFieldDeclarationType decl)
           
 void addInnerDeclaration(JTypeDeclarationType decl)
           
 void addMethodDeclaration(JMethodDeclarationType decl)
           
protected  void clear()
          Prepares this instance for recycling by clearing all the data stored in its ArrayLists.
 JPhylum[] getFieldsAndInits()
           
 ArrayList getInnerClasses()
           
static CParseClassContext getInstance()
          Factory method returns an instance of CParseClassContext.
 ArrayList getMethods()
           
 void release()
          Calls the static method release(this)
static void release(CParseClassContext context)
          Erases the data stored in context and pushes the instance onto a stack for recycling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methods

private ArrayList methods

inners

private ArrayList inners

fieldsAndInits

private ArrayList fieldsAndInits

stack

private static Stack stack
Constructor Detail

CParseClassContext

protected CParseClassContext()
Hides the default constructor except to subclasses.

Method Detail

getInstance

public static CParseClassContext getInstance()
Factory method returns an instance of CParseClassContext. The instance is recycled from the stack of discarded instances or a new instance is minted if the stack is empty.

Returns:
a "new" CParseClassContext instance

release

public void release()
Calls the static method release(this)


release

public static void release(CParseClassContext context)
Erases the data stored in context and pushes the instance onto a stack for recycling.

Parameters:
context - a used instance to be recycled

clear

protected void clear()
Prepares this instance for recycling by clearing all the data stored in its ArrayLists.


addFieldDeclaration

public void addFieldDeclaration(JFieldDeclarationType decl)

addMethodDeclaration

public void addMethodDeclaration(JMethodDeclarationType decl)

addInnerDeclaration

public void addInnerDeclaration(JTypeDeclarationType decl)

addBlockInitializer

public void addBlockInitializer(JClassBlock block)

getMethods

public ArrayList getMethods()

getInnerClasses

public ArrayList getInnerClasses()

getFieldsAndInits

public JPhylum[] getFieldsAndInits()

mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.