COM.hugin.HAPI
Class ClassCollection

java.lang.Object
  |
  +--COM.hugin.HAPI.ClassCollection

public class ClassCollection
extends java.lang.Object

Classes are grouped into ClassCollections. Each class must belong to exactly one ClassCollection. A ClassCollection can be considered a closed world of interdependent Classes (i.e., Bayesian networks and influence diagrams). That is, each Class may contain instances of other Classes of the ClassCollection, but not of Classes of other ClassCollections.

Different operations are supported for ClassCollections:

  • Creation and deletion
  • Addition of Class objects specified in NET files
  • Saving to a NET file
  • Retrieval of the list of Class objects
  • Retrieval of a Class object by its name

  • Constructor Summary
    ClassCollection()
              Constructs a new (empty) ClassCollection.
     
    Method Summary
     void delete()
              Deletes this ClassCollection and all its Classs.
     Class getClassByName(java.lang.String name)
              Returns the Class of this ClassCollection that has a given name.
     ClassList getMembers()
              Returns a ClassList containing the Class members of this ClassCollection.
     void parseClasses(java.lang.String fileName)
              Constructs one or more classes from a NET file.
     void parseClasses(java.lang.String fileName, ClassParseListener pl)
              Constructs one or more classes from a NET file.
     void saveAsNet(java.lang.String fileName)
              Writes a NET description of the ClassCollection to a file.
     java.lang.String toString()
              Returns a String of names of the member Classes of this ClassCollection.
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    ClassCollection

    public ClassCollection()
                    throws ExceptionHugin
    Constructs a new (empty) ClassCollection.
    Method Detail

    parseClasses

    public void parseClasses(java.lang.String fileName,
                             ClassParseListener pl)
                      throws ExceptionHugin
    Constructs one or more classes from a NET file.

    Parameters:
    fileName - A String containing the name of the NET file.
    pl - a ClassParseListener.

    parseClasses

    public void parseClasses(java.lang.String fileName)
                      throws ExceptionHugin
    Constructs one or more classes from a NET file. This method uses a DefaultClassParseListener.

    Parameters:
    fileName - A string containing the name of the NET file.

    delete

    public void delete()
                throws ExceptionHugin,
                       ExceptionObjectNotAlive
    Deletes this ClassCollection and all its Classs.

    getMembers

    public ClassList getMembers()
                         throws ExceptionHugin,
                                ExceptionObjectNotAlive
    Returns a ClassList containing the Class members of this ClassCollection.

    getClassByName

    public Class getClassByName(java.lang.String name)
                         throws ExceptionObjectNotAlive,
                                ExceptionHugin
    Returns the Class of this ClassCollection that has a given name.

    Parameters:
    name - A string representing the name of a Class.

    saveAsNet

    public void saveAsNet(java.lang.String fileName)
                   throws ExceptionObjectNotAlive,
                          ExceptionHugin
    Writes a NET description of the ClassCollection to a file.

    Parameters:
    filename - a string containing the name of the file.

    toString

    public java.lang.String toString()
    Returns a String of names of the member Classes of this ClassCollection.

    Overrides:
    toString in class java.lang.Object
    Returns:
    A String like e.g., "{ ClassA, ClassB }".