com.sun.jini.outrigger
Class TypeTree

java.lang.Object
  extended by com.sun.jini.outrigger.TypeTree

 class TypeTree
extends Object

A type tree for entries. It maintains, for each class, a list of known subclasses so that we can walk down the relevant subpart of the subtype tree for a template, looking for matching entries. This list of subtypes is not current garbage collected -- if a subtype was once written, it's subtype entry will never be removed from this tree. All operations are done via class name.

Author:
Sun Microsystems, Inc.
See Also:
OutriggerServerImpl

Nested Class Summary
(package private)  class TypeTree.RandomizedIterator
          This class implements a randomized iterator over the TypeTree.
private  class TypeTree.TypeTreeIterator
          An iterator that will walk through a list of known types.
 
Field Summary
private static Random numgen
          A generator used to randomize the order of iterator returns
private static String ROOT
          Name of the root bucket of the type tree
private  Hashtable subclasses
          For each type, a vector of known subtypes
 
Constructor Summary
TypeTree()
           
 
Method Summary
private  boolean addKnown(String superclass, String subclass)
          Add the subclass to the list of known subclasses of this superclass.
(package private)  void addTypes(EntryRep bits)
          Update the type tree with the given bits.
private  Vector classVector(String whichClass)
          Return the vector of subclasses for the given class.
(package private)  Iterator subTypes(String className)
          Return an iterator over the subtypes of the given class (including the type itself).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subclasses

private Hashtable subclasses
For each type, a vector of known subtypes


numgen

private static final Random numgen
A generator used to randomize the order of iterator returns


ROOT

private static final String ROOT
Name of the root bucket of the type tree

Constructor Detail

TypeTree

TypeTree()
Method Detail

classVector

private Vector classVector(String whichClass)
Return the vector of subclasses for the given class.


subTypes

Iterator subTypes(String className)
Return an iterator over the subtypes of the given class (including the type itself). This implementation always returns an iterator that randomizes the order of the classes returned. In other words, it returns the names of all classes that are instances of the class that named, in a random ordering.


addTypes

void addTypes(EntryRep bits)
Update the type tree with the given bits. This will traverse the given EntryRep's list of superclasses, retrieve the subclass list at each list item and update it with the given EntryRep's type. SupClass List | V SupC1-->Sub1OfSupC1--Sub2OfSupC1...SubNOfSupC1--EntryRep | | SupC2-->Sub1OfSupC2--Sub2OfSupC2...SubNOfSupC2--EntryRep . . . SupCN-->Sub1OfSupCN--Sub2OfSupCN...SubNOfSupCN--EntryRep


addKnown

private boolean addKnown(String superclass,
                         String subclass)
Add the subclass to the list of known subclasses of this superclass.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.