FileDocCategorySizeDatePackage
AutoMIDletInfoList.javaAPI DocphoneME MR2 API (J2ME)5414Wed May 02 18:00:08 BST 2007com.sun.midp.automation

AutoMIDletInfoList

public class AutoMIDletInfoList extends Object
AutoMIDletInfo list

Fields Summary
private Vector
midletsInfo
Vector of AutoMIDletInfo objects
private static AutoMIDletInfoList
midletInfoList
The one and only instance of AutoMIDletInfoList
Constructors Summary
AutoMIDletInfoList()
Private constructor to prevent direct creation of instances.


                 
     
        midletsInfo = new Vector();
    
Methods Summary
AutoMIDletInfoaddToList(int suiteID, java.lang.String midletClassName)
Creates AutoMIDletInfo and adds it to the list.

param
suiteID suite ID
param
midletClassName MIDlet's class name
return
created AutoMIDletInfo instance

        synchronized (this) {
            AutoMIDletInfo info =
                new AutoMIDletInfo(suiteID, midletClassName);
            midletsInfo.addElement(info);

            return info;
        }
    
AutoMIDletImplfindMIDlet(MIDletProxy midletProxy)
Finds AutoMIDlet corresponding to specified MIDletProxy.

param
midletProxy MIDletProxy instance
return
AutoMIDletImpl instance corresponding to MIDletProxy, or null if it hasn't been found

        AutoMIDletImpl midlet = null;
        AutoMIDletInfo info = findMIDletInfo(midletProxy);
        if (info != null) {
            midlet = info.midlet;
        }

        return midlet;
    
AutoMIDletInfofindMIDletInfo(int suiteID, java.lang.String midletClassName)
Finds MIDlet info by MIDlet's suite ID and class name.

param
suiteID suite ID
param
midletClassName MIDlet's class name
return
corresponding AutoMIDletInfo instance or null, if it hasn't been found

        synchronized (this) {
            for (int i = 0; i < midletsInfo.size(); ++i) {
                AutoMIDletInfo info =
                    (AutoMIDletInfo)midletsInfo.elementAt(i);
                if (info.suiteID == suiteID &&
                    info.midletClassName.equals(midletClassName)) {
                    return info;
                }
            }
        }

        return null;
    
AutoMIDletInfofindMIDletInfo(AutoMIDletImpl midlet)
Finds MIDlet info by AutoMIDletImpl.

param
midlet AutoMIDletImpl reference to be used as key
return
corresponding AutoMIDletInfo instance or null, if it hasn't been found

        synchronized (this) {
            for (int i = 0; i < midletsInfo.size(); ++i) {
                AutoMIDletInfo info =
                    (AutoMIDletInfo)midletsInfo.elementAt(i);
                if (info.midlet == midlet) {
                    return info;
                }
            }
        }

        return null;
    
AutoMIDletInfofindMIDletInfo(MIDletProxy midletProxy)
Finds MIDlet info by MIDletProxy.

param
midletProxy MIDletProxy reference to be used as key
return
corresponding AutoMIDletInfo instance or null, if it hasn't been found

        AutoMIDletInfo info = findMIDletInfo(
                midletProxy.getSuiteId(), midletProxy.getClassName());

        return info;
    
MIDletProxyfindMIDletProxy(AutoMIDletImpl midlet)
Finds MIDletProxy corresponding to specified AutoMIDlet

param
midlet AutoMIDletImpl instance
return
MIDletProxy instance corresponding to AutoMIDletImpl, or null if it hasn't been found

        MIDletProxy midletProxy = null;
        AutoMIDletInfo info = findMIDletInfo(midlet);
        if (info != null) {
            midletProxy = info.midletProxy;
        }

        return midletProxy;
    
static synchronized com.sun.midp.automation.AutoMIDletInfoListgetMIDletInfoList()
Gets AutoMIDletInfoList instance.

return
AutoMIDletInfoList instance

        if (midletInfoList == null) {
            midletInfoList = new AutoMIDletInfoList();
        }

        return midletInfoList;
    
voidremoveFromList(AutoMIDletInfo info)
Removes specified AutoMIDletInfo instance from list.

param
info AutoMIDletInfo instance to be removed

        midletsInfo.removeElement(info);