ClassCollection
public class ClassCollection
Classes are grouped into ClassCollection
s. Each class must belong
to exactly one ClassCollection
. A ClassCollection
can be
considered a closed world of interdependent classes (i.e., Bayesian
networks and LIMIDs). That is, each class may contain instances of
other classes of the ClassCollection
, but not of classes of other
ClassCollection
s.
ClassCollection
objects are automatically deallocated when the
last reference to the object disappears. When this happens, all
objects “owned” by the ClassCollection
object (such as member
classes and nodes in those classes) are deleted, so make sure to
hold on to the ClassCollection
object until it is no longer
needed.
-
Constructs a new empty
ClassCollection
.Declaration
Swift
public convenience init(license: License? = nil) throws
Parameters
license
license data to be used instead of a license file.
-
Constructs a class collection by loading the corresponding Hugin Knowledge Base (HKB) file. The HKB file must contain a class collection.
Declaration
Swift
public convenience init(hkbName: String, password: String? = nil, license: License? = nil) throws
Parameters
hkbName
the name of the HKB file
password
a password needed to load the file.
license
license data to be used instead of a license file.
-
Constructs one or more
Class
es from a NET file, and adds them to thisClassCollection
.Declaration
Swift
public func parseClasses(netName: String) throws
Parameters
netName
the name of the NET file.
-
Constructs one or more
Class
es from a NET description provided as a string, and adds them to thisClassCollection
.Declaration
Swift
public func parseClasses(netString: String) throws
Parameters
netString
the NET description
-
Returns a ClassList containing the members of this
ClassCollection
.Declaration
Swift
public func getMembers() throws -> [Class]
-
Returns the Class of this
ClassCollection
that has the given name. If no such class exists, an error is thrown.Declaration
Swift
public func getClass(name: String) throws -> Class?
Parameters
name
A string representing the name of a Class.
-
Writes a NET description of this
ClassCollection
to a file.Declaration
Swift
public func save(netName: String) throws
Parameters
netName
the name of the NET file.
-
Creates a NET description of this
ClassCollection
.Declaration
Swift
public func toNetString() throws -> String
Return Value
A string containing the NET description.
-
Saves this
ClassCollection
as a Hugin Knowledge Base (HKB) file. Ifpassword
is non-nil
, the file will be password protected. This password must be used in order to load the file.Declaration
Swift
public func save(hkbName: String, password: String? = nil) throws
Parameters
hkbName
the name of the file to which the HKB is saved.
password
if non-
nil
, this must be used in order to load the HKB file.