ClassCollection
public class ClassCollection
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 LIMIDs). That is, each class may contain instances of
other classes of the ClassCollection, but not of classes of other
ClassCollections.
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) throwsParameters
licenselicense 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) throwsParameters
hkbNamethe name of the HKB file
passworda password needed to load the file.
licenselicense data to be used instead of a license file.
-
Constructs one or more
Classes from a NET file, and adds them to thisClassCollection.Declaration
Swift
public func parseClasses(netName: String) throwsParameters
netNamethe name of the NET file.
-
Constructs one or more
Classes from a NET description provided as a string, and adds them to thisClassCollection.Declaration
Swift
public func parseClasses(netString: String) throwsParameters
netStringthe NET description
-
Returns a ClassList containing the members of this
ClassCollection.Declaration
Swift
public func getMembers() throws -> [Class] -
Returns the Class of this
ClassCollectionthat has the given name. If no such class exists, an error is thrown.Declaration
Swift
public func getClass(name: String) throws -> Class?Parameters
nameA string representing the name of a Class.
-
Writes a NET description of this
ClassCollectionto a file.Declaration
Swift
public func save(netName: String) throwsParameters
netNamethe name of the NET file.
-
Creates a NET description of this
ClassCollection.Declaration
Swift
public func toNetString() throws -> StringReturn Value
A string containing the NET description.
-
Saves this
ClassCollectionas a Hugin Knowledge Base (HKB) file. Ifpasswordis 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) throwsParameters
hkbNamethe name of the file to which the HKB is saved.
passwordif non-
nil, this must be used in order to load the HKB file.
ClassCollection Class Reference