Class ClassCollection
Classes are grouped into ClassCollections.
Inherited Members
Namespace: HAPI
Assembly: hugincs-9.4-netstandard2.0-x64.dll
Syntax
public class ClassCollection
Remarks
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
Constructors
ClassCollection()
Constructs a new (empty) ClassCollection.
Declaration
public ClassCollection()
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
ClassCollection(string, string)
Constructs a class collection by loading the corresponding Hugin Knowledge Base (HKB) file. The HKB file must contain a class collection.
Declaration
public ClassCollection(string hkbFileName, string password)
Parameters
Type | Name | Description |
---|---|---|
string | hkbFileName | the name of the HKB file. |
string | password | a password needed to load the file. |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
ClassCollection(string)
Constructs a class collection by loading the corresponding Hugin Knowledge Base (HKB) file. The HKB file must contain a class collection.
Declaration
public ClassCollection(string hkbFileName)
Parameters
Type | Name | Description |
---|---|---|
string | hkbFileName | the name of the HKB file. |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
Methods
Delete()
Deletes this ClassCollection and all its Classs.
Declaration
public void Delete()
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
GetClassByName(string)
Returns the Class of this ClassCollection that has the given
name. If no such class exists, null
is returned.
Declaration
public Class GetClassByName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | A string representing the name of a Class. |
Returns
Type | Description |
---|---|
Class |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
GetMembers()
Returns a ClassList containing the Class members of this ClassCollection.
Declaration
public ClassList GetMembers()
Returns
Type | Description |
---|---|
ClassList |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
IsAlive()
Is this ClassCollection object alive?
Declaration
public bool IsAlive()
Returns
Type | Description |
---|---|
bool |
ParseClasses(string, ClassParseListener)
Constructs one or more classes from a NET file or a NET description given as a string.
Declaration
public void ParseClasses(string netStringOrFileName, ClassParseListener parseListener)
Parameters
Type | Name | Description |
---|---|---|
string | netStringOrFileName | a string containing a NET description or the name of a NET file |
ClassParseListener | parseListener | a ClassParseListener. |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
ParseClasses(string)
Constructs one or more classes from a NET file or a NET description given as a string.
Declaration
public void ParseClasses(string netStringOrFileName)
Parameters
Type | Name | Description |
---|---|---|
string | netStringOrFileName | netStringOrFileName a string containing a NET description or the name of a NET file. |
Remarks
This method uses a DefaultClassParseListener.
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
SaveAsKB(string, string)
Saves this ClassCollection as a Hugin Knowledge Base (HKB) to a file.
Declaration
public void SaveAsKB(string fileName, string password)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | the name of the file to which the HKB is saved. |
string | password | which, if non- |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
SaveAsKB(string)
Saves this ClassCollection as a Hugin Knowledge Base (HKB) to a file.
Declaration
public void SaveAsKB(string fileName)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | the name of the file to which the HKB is saved. |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
SaveAsNet(string)
Writes a NET description of the ClassCollection to a file.
Declaration
public void SaveAsNet(string fileName)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | a string containing the name of the file. |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
ToNetString()
Creates a NET description of this ClassCollection.
Declaration
public string ToNetString()
Returns
Type | Description |
---|---|
string | A string containing the NET description. |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |
ToString()
Returns a String of names of the member Classes of this ClassCollection.
Declaration
public string ToString()
Returns
Type | Description |
---|---|
string |
Exceptions
Type | Condition |
---|---|
ExceptionHugin |