<s> package org . eclipse . jdt . internal . core ; import java . util . ArrayList ; import org . eclipse . jdt . core . IField ; import org . eclipse . jdt . core . IInitializer ; import org . eclipse . jdt . core . IMethod ; import org . eclipse . jdt . core . IPackageFragment ; import org . eclipse . jdt . core . IType ; public class JavaElementRequestor implements IJavaElementRequestor { protected boolean canceled = false ; protected ArrayList fields = null ; protected ArrayList initializers = null ; protected ArrayList memberTypes = null ; protected ArrayList methods = null ; protected ArrayList packageFragments = null ; protected ArrayList types = null ; protected static final IField [ ] EMPTY_FIELD_ARRAY = new IField [ 0 ] ; protected static final IInitializer [ ] EMPTY_INITIALIZER_ARRAY = new IInitializer [ 0 ] ; protected static final IType [ ] EMPTY_TYPE_ARRAY = new IType [ 0 ] ; protected static final IPackageFragment [ ] EMPTY_PACKAGE_FRAGMENT_ARRAY = new IPackageFragment [ 0 ] ; protected static final IMethod [ ] EMPTY_METHOD_ARRAY = new IMethod [ 0 ] ; public void acceptField ( IField field ) { if ( this . fields == null ) { this . fields = new ArrayList ( ) ; } this . fields . add ( field ) ; } public void acceptInitializer ( IInitializer initializer ) { if ( this . initializers == null ) { this . initializers = new ArrayList ( ) ; } this . initializers . add ( initializer ) ; } public void acceptMemberType ( IType type ) { if ( this . memberTypes == null ) { this . memberTypes = new ArrayList ( ) ; } this . memberTypes . add ( type ) ; } public void acceptMethod ( IMethod method ) { if ( this . methods == null ) { this . methods = new ArrayList ( ) ; } this . methods . add ( method ) ; } public void acceptPackageFragment ( IPackageFragment packageFragment ) { if ( this . packageFragments == null ) { this . packageFragments = new ArrayList ( ) ; } this . packageFragments . add ( packageFragment ) ; } public void acceptType ( IType type ) { if ( this . types == null ) { this . types = new ArrayList ( ) ; } this . types . add ( type ) ; } public IField [ ] getFields ( ) { if ( this . fields == null ) { return EMPTY_FIELD_ARRAY ; } int size = this . fields . size ( ) ; IField [ ] results = new IField [ size ] ; this . fields . toArray ( results ) ; return results ; } public IInitializer [ ] getInitializers ( ) { if ( this . initializers == null ) { return EMPTY_INITIALIZER_ARRAY ; } int size = this . initializers . size ( ) ; IInitializer [ ] results = new IInitializer [ size ] ; this . initializers . toArray ( results ) ; return results ; } public IType [ ] getMemberTypes ( ) { if ( this . memberTypes == null ) { return EMPTY_TYPE_ARRAY ; } int size = this . memberTypes . size ( ) ; IType [ ] results = new IType [ size ] ; this . memberTypes . toArray ( results ) ; return results ; } public IMethod [ ] getMethods ( ) { if ( this . methods == null ) { return EMPTY_METHOD_ARRAY ; } int size = this . methods . size ( ) ; IMethod [ ] results = new IMethod [ size ] ; this . methods . toArray ( results ) ; return results ; } public IPackageFragment [ ] getPackageFragments ( ) { if ( this . packageFragments == null ) { return EMPTY_PACKAGE_FRAGMENT_ARRAY ; } int size = this . packageFragments . size ( ) ; IPackageFragment [ ] results = new IPackageFragment [ size ] ; this . packageFragments . toArray ( results ) ; return results ; } public IType [ ] getTypes ( ) { if ( this . types == null ) { return EMPTY_TYPE_ARRAY ; } int size = this . types . size ( ) ; IType [ ] results = new IType [ size ] ; this . types . toArray ( results ) ; return results ; } public boolean isCanceled ( ) { return this . canceled ; } public void reset ( ) { this . canceled = false ; this . fields = null ; this . initializers = null ; this . memberTypes = null ; this . methods = null ; this . packageFragments = null ; this . types = null ; } public void setCanceled ( boolean b ) { this . canceled = b ; } } </s>