示例#1
0
 public Vector getAssociatedLevelLists() {
   Vector levelLists = new Vector();
   Vector endPts = CollectionHelper.makeVector("Keyword");
   Hashtable keywordParents =
       oncotcap.Oncotcap.getDataSource()
           .getParentTree(
               "Keyword", endPts, CollectionHelper.makeVector(this), TreeDisplayModePanel.ROOT);
   // Take each of the parents and get the associated level lists
   if (keywordParents.size() <= 0) return levelLists;
   Hashtable levelListsHashtable =
       oncotcap.Oncotcap.getDataSource()
           .getInstanceTree(
               "EnumLevelList",
               new Vector(),
               makeLevelListFilter(keywordParents),
               TreeDisplayModePanel.ROOT);
   for (Enumeration e = keywordParents.keys(); e.hasMoreElements(); ) {
     System.out.println("Keyword.getAssociatedLevelLists: " + e.nextElement());
   }
   // Collect all the level lists from the hashtable
   Vector selectedItems = CollectionHelper.makeVector(keyword);
   for (Enumeration e = levelListsHashtable.keys(); e.hasMoreElements(); ) {
     Object obj = e.nextElement();
     if (obj instanceof EnumLevelList) {
       levelLists.addElement(obj);
     }
   }
   return levelLists;
 }
示例#2
0
  /**
   * When this class is loaded, preload the cache with a few items which we think will often be
   * needed. This can avoid the necessity of running a belief network context in simple problems.
   */
  static {
    System.err.println("PiHelperLoader.static: preload the helper cache.");

    helper_cache = new Hashtable();
    Vector seq = new Vector();

    seq.addElement(riso.distributions.ConditionalDiscrete.class);
    seq.addElement(riso.distributions.Discrete.class);

    helper_cache.put(
        new HelperCacheKey("pi", seq),
        riso.distributions.computes_pi.ConditionalDiscrete_Discrete.class);

    seq = new Vector();
    seq.addElement(riso.distributions.Discrete.class);

    helper_cache.put(
        new HelperCacheKey("lambda", seq), riso.distributions.computes_lambda.Discrete.class);

    seq = new Vector();
    seq.addElement(riso.distributions.AbstractDistribution.class);
    seq.addElement(riso.distributions.AbstractDistribution.class);

    helper_cache.put(
        new HelperCacheKey("pi_message", seq),
        riso.distributions.computes_pi_message.AbstractDistribution_AbstractDistribution.class);

    seq = new Vector();
    seq.addElement(riso.distributions.ConditionalDiscrete.class);
    seq.addElement(riso.distributions.Discrete.class);
    seq.addElement(riso.distributions.Discrete.class);

    helper_cache.put(
        new HelperCacheKey("lambda_message", seq),
        riso.distributions.computes_lambda_message.ConditionalDiscrete_Discrete_Discrete.class);

    seq = new Vector();
    seq.addElement(riso.distributions.ConditionalDiscrete.class);
    seq.addElement(riso.distributions.Discrete.class);

    helper_cache.put(
        new HelperCacheKey("lambda_message", seq),
        riso.distributions.computes_lambda_message.ConditionalDiscrete_Discrete_.class);

    seq = new Vector();
    seq.addElement(riso.distributions.Discrete.class);
    seq.addElement(riso.distributions.Discrete.class);

    helper_cache.put(
        new HelperCacheKey("posterior", seq),
        riso.distributions.computes_posterior.Discrete_Discrete.class);

    System.err.println("PiHelperLoader.static: helper_cache.size(): " + helper_cache.size());
  }
示例#3
0
    public org.omg.CORBA.Contained[] lookup_name( String search_name, 
                                                  int levels_to_search, 
                                                  org.omg.CORBA.DefinitionKind limit_type, 
                                                  boolean exclude_inherited )
    {
        if( levels_to_search == 0 )
            return null;

        org.omg.CORBA.Contained[] c = contents( limit_type, exclude_inherited );
        Hashtable found = new Hashtable();

        for( int i = 0; i < c.length; i++)
            if( c[i].name().equals( search_name ) )
                found.put( c[i], "" );

        if( levels_to_search > 1 || levels_to_search == -1 )
        {
            // search up to a specific depth or undefinitely
            for( int i = 0; i < c.length; i++)
            {
                if( c[i] instanceof org.omg.CORBA.Container )
                {
                    org.omg.CORBA.Contained[] tmp_seq = 
                        ((org.omg.CORBA.Container)c[i]).lookup_name( search_name, 
                                                                     levels_to_search-1, 
                                                                     limit_type, 
                                                                     exclude_inherited);
                    if( tmp_seq != null )
                        for( int j = 0; j < tmp_seq.length; j++)
                            found.put( tmp_seq[j], "" );
                }
            } 			
        }

		
        org.omg.CORBA.Contained[] result = new org.omg.CORBA.Contained[ found.size() ];
        int idx = 0;

        for( Enumeration e = found.keys(); e.hasMoreElements(); )
            result[ idx++] = (org.omg.CORBA.Contained)e.nextElement();

        return result;
    }
示例#4
0
    public org.omg.CORBA.Contained[] contents(org.omg.CORBA.DefinitionKind limit_type, 
                                              boolean exclude_inherited)
    {
        Hashtable limited = new Hashtable();

        // analog constants, exceptions etc.

        for( Enumeration e = contained.elements(); e.hasMoreElements();  )
        {
            org.omg.CORBA.Contained c = (org.omg.CORBA.Contained)e.nextElement();
            if( limit_type == org.omg.CORBA.DefinitionKind.dk_all || 
                limit_type == c.def_kind() )
            {
                limited.put( c, "" );
            }
        }

        org.omg.CORBA.Contained[] c = new org.omg.CORBA.Contained[limited.size()];
        int i;
        Enumeration e;
        for( e = limited.keys(), i=0 ; e.hasMoreElements(); i++ )
            c[i] = (org.omg.CORBA.Contained)e.nextElement();
        return c;			
    }